﻿@using LanDBom.Models;
@using LanDBom.Resources
@{
    ViewBag.Title = "ERPGongy";
    Layout = "~/Views/Shared/_Genertals.cshtml";
}
@section styles{
    <style>
        .inp {
            width: 100px;
            height: 30px;
        }

        .jisnd {
            display: flex;
            justify-content: space-around;
            align-items: center;
        }

        input[type=number]::-webkit-inner-spin-button,
        input[type=number]::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
    </style>
}
<from>
    <fieldset class="boun">
        <legend></legend>
        <div class="row bian">
            <div class="anzhu" style="text-align:right">
                <div style="display:flex">
                    <input type="button" id="Quebecs" value="@Resource.String361" class="ant-btn-circle-outline" />
                    <input type="button" id="ERjl" value="@Resource.String795" class="ant-btn-circle-outline" />
                    <input type="button" id="TONGB" value="物料工艺同步" class="ant-btn-circle-outline" />
                    <input type="button" id="FanhuiJK" class="btn-outline" value="返回" />
                </div>
            </div>
        </div>
    </fieldset>
</from>
<div id="WT_dh_mb" style="display:none;position:fixed;background-color:white;top:200px;width:660px;left:300px;z-index:1000;border:1px black solid;">
    <div id="WJ_ID" style="display:none"></div>
    <table>
        <tr>
            <td>驳回节点：</td>
            <td>
                <select id="BHJD">
                    <option value="1">上一步</option>
                    <option value="2">报价发起</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>@Resource.String501：</td>
            <td id="WT_dhr"></td>
        </tr>
        <tr>
            <td>@Resource.String502</td>
            <td><textarea id="WT_dhly"></textarea></td>
        </tr>
        <tr>
            <td id="WT_qdbh">@Resource.String503</td>
            <td id="WT_qxbh">@Resource.String504</td>
        </tr>
    </table>
</div>
<div style="display:none" id="shenDan">@(Session["appp_id"])</div>
<div>
    <from class="nav padtop  biao1">
        <fieldset class="boun">
            <legend class="len1">@Resource.String1010</legend>
            <div class="nav">
                <div class="row houn col-10">
                    <p class="col-sm-4">@Html.Label(Resource.Stringkh)  @Html.TextBox("liao")</p>
                    <p class="col-sm-4">@Html.Label(Resource.String449):@Html.TextBox("shu")</p>
                    <p class="col-sm-3">
                        <input type="button" id="BomS" value="@Resource.String155" class="btn-sm btn-light" />
                    </p>
                    @*<p class="col-sm-2"><input type="button" id="Quebecs" value="确定" class="btn" /></p>*@
                </div>
                @*<div class="col-2">
                        <input type="button" name="Sheji" value="设计委托" class="btn-sm btn-light" disabled />
                    </div>*@
            </div>

        </fieldset>
    </from>

    <table class="table table-sm gun tab">
        <thead class="" id="BoCt">
            <tr style="text-align-last: center; background-color: #6e95bc">
                <th scope="col" style="width:50px">@Resource.String1000</th>
                <th scope="col">物料信息</th>
                <th scope="col">@Resource.String1001</th>
                <th scope="col">@Resource.String1002</th>
                <th scope="col">@Resource.String1003</th>
                <th scope="col" style="width:300px">@Resource.String1004</th>
                <th scope="col">@Resource.String1005</th>
                <th scope="col">@Resource.String1006</th>
                <th scope="col">@Resource.String1007</th>
                <th scope="col">@Resource.String1008</th>
                <th scope="col">@Resource.String1009</th>
                <th scope="col">理论价格</th>

                <th scope="col" style="width:50px">母列</th>
                <th scope="col" style="width:50px">子列</th>
            </tr>
        </thead>
        <tbody data-spy="scroll" id="BoTa" class="thead-light" style="height:600px;">
        </tbody>
    </table>
</div>
@*隐藏工艺选项 工艺选项分类：模切，彩印 印刷（使用下拉列表显示所有印刷工艺） 木箱加工 标签类型 是否提供资料 *@
<div style="display: none;" class="Dyang" id="DyangSE">
    <div style=" width: 100%; background-color: #bacee9;" class="Tuodong"><span>点击这里拖动窗体</span></div>
    @*<select id="Qiehaun">
            <option value="水印纸箱">水印纸箱</option>
            <option value="彩印纸箱">彩印纸箱</option>
        </select>*@
    <div>
        <span>选择尺寸算法</span>
        <select id="Chijisnn">
            <option value="2">制造尺寸</option>
            <option value="1">内径尺寸</option>
            <option value="3">外径尺寸</option>
        </select>
    </div>
    <div id="SY_divs" style=" overflow: auto; height: 600px; overflow-x:hidden;">
        <form class=" padtop biao1">
            <fieldset style="width:100%; padding-left:13px;" class="boun">
                @*水印纸箱*@
                <fieldset class="boun">
                    <legend class="len1">@Resource.String48</legend>
                    <table title="@Resource.String450">
                        @*水印纸箱的基本信息 && @item.LB_fne.Length<3*@
                        <tr>
                            <td>@Resource.String58：</td>
                            <td id="NAmeok"></td>
                            <td id="WLaoed" style="display:none"></td>
                            <td>@Resource.String1011</td>
                            <td id="BUJian"></td>
                        </tr>
                        <tr class="leibieshu">
                            <td>@Resource.String104：</td>
                            <td></td>
                            <td>@Resource.String105</td>
                            <td></td>
                        </tr>
                        <tr class="MIaoshud">
                            <td>描述：</td>
                            <td></td>
                            <td>原材料：</td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>@Resource.String1012：</td>
                            <td>
                                <select id="ZB_ms">
                                    @foreach (var item in ViewBag.ListZBxx as List<libray>)
                                    {
                                        if (@item.ST_ID == 10 && item.LB_fne != "A+1")
                                        {
                                            <option value="@item.LB_fne">@item.LB_fne</option>
                                        }
                                    }
                                </select>
                            </td>
                            <td>@Resource.String1013</td>
                            <td id="ZB_HD"></td>
                        </tr>
                        <tr>
                            <td>@Resource.String1014：</td>
                            <td>
                                <select id="Lei_xin">
                                    <option value="1">0200(有底无盖箱)</option>
                                    <option value="2">0201(普通开槽箱)</option>
                                    <option value="3">0203(全叠盖开槽箱)</option>
                                    <option value="4">0427(pizza盒型)</option>
                                    <option value="5">拉链箱</option>
                                    <option value="6">0201开槽箱（电商）</option>
                                    <option value="7">0201模切箱（电商）</option>
                                    <option value="8">异型箱（电商）</option>
                                    <option value="9">异型箱(通用)</option>
                                </select>
                            </td>
                            <td>@Resource.String115：</td>
                            <td></td>
                        </tr>
                        <tr id="GUigesed">
                            <td>@Resource.String1015:</td>
                            <td>
                                @Resource.String1016：
                                <input type="number" name="SHUNHH" value="" min="0" style="width:100px;" class="zhnagkai" />
                            </td>
                            <td>
                                @Resource.String1017:
                                <input type="number" name="SHUNHKK" value="" min="0" style="width:100px;" class="zhnagkai" />
                            </td>
                            <td>
                                @Resource.String1018：
                                <input type="number" name="SHH" value="" min="0" style="width:100px;" class="zhnagkai" />
                            </td>
                            <td id="jinded" style="display:none">
                                @Resource.String1019：
                                <input type="number" name="KKNDS" value="30" min="0" style="width:80px;" class="zhnagkai" />
                            </td>
                        </tr>
                        <tr style="display:none">
                            <td>@Resource.String1015:</td>
                            <td>
                                @Resource.String1016：
                                <input type="number" name="S_num1" />
                            </td>
                            <td>
                                @Resource.String1017：
                                <input type="number" name="S_num2" />
                            </td>
                            <td>
                                @Resource.String1018：
                                <input type="number" name="S_num3" />
                            </td>
                            <td>
                                @Resource.String1019：
                                <input type="number" name="S_num4" />
                            </td>
                        </tr>
                        <tr>
                            <td>@Resource.String1020：</td>
                            <td colspan="2">
                                <input type="number" name="Z_Cs" value="" min="0" style="width:130px;" />*
                                <input type="number" name="Z_Ks" value="" min="0" style="width:130px;" />
                            </td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>@Resource.String1021</td>
                            <td id="Tijian"></td>
                            <td id="Mianjihdhu"></td>
                        </tr>
                    </table>
                </fieldset>
                <fieldset class="boun">
                    <legend class="len1">@Resource.String1022</legend>
                    <table>
                        <tr>
                            <td>@Resource.String1023</td>
                            <td>
                                <span id="ZB_sh"></span>&nbsp;%
                            </td>
                            <td>@Resource.String1024</td>
                            <td>
                                <span id="jiahjoks"></span>&nbsp;@Resource.String1025
                            </td>
                            <td>@Resource.String1026</td>
                            <td>
                                <span id="ZB_jgf"></span>&nbsp;@Resource.String1025/㎡
                            </td>
                        </tr>
                    </table>
                    <hr />
                    <table id="ZB_ZC_table">
                        <thead>
                            <tr>
                                <td>@Resource.String1027</td>
                                <td>
                                    <select class="ZB_CS" style="width:120px;">
                                        <option>@Resource.String63</option>
                                        @foreach (var item in ViewBag.ListPP as List<parice>)
                                        {
                                            if (@item.PA_Shuxing == 5 && item.PA_LengBie != "瓦")
                                            {
                                                <option value="@item.PA_LengBie">@item.PA_LengBie</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td>
                                    <select class="ZB_KZ" style="width:300px;">
                                    </select>
                                </td>
                                <td></td>
                                <td class="ZB_Unit_price"></td>
                            </tr>
                        </thead>
                        <tbody id="ZB_XZC">
                        </tbody>
                        <tfoot>
                            <tr>
                                <td>@Resource.String1028</td>
                                <td>
                                    <select class="ZB_CS" style="width:120px;">
                                        <option>@Resource.String63</option>
                                        @foreach (var item in ViewBag.ListPP as List<parice>)
                                        {
                                            if (@item.PA_Shuxing == 5 && @item.PA_LengBie.Contains("瓦"))
                                            {
                                                <option value="@item.PA_LengBie">@item.PA_LengBie</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td>
                                    <select class="ZB_KZ" style="width:300px;">
                                    </select>
                                </td>
                                <td></td>
                                <td class="ZB_Unit_price"></td>
                            </tr>
                            <tr>
                                <td>@Resource.String1029</td>
                                <td>
                                    <select class="ZB_CS" style="width:120px;">
                                        <option>@Resource.String63</option>
                                        @foreach (var item in ViewBag.ListPP as List<parice>)
                                        {
                                            if (@item.PA_Shuxing == 5)
                                            {
                                                <option value="@item.PA_LengBie">@item.PA_LengBie</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td>
                                    <select class="ZB_KZ" style="width:300px;">
                                    </select>
                                </td>
                                <td></td>
                                <td class="ZB_Unit_price"></td>
                            </tr>
                        </tfoot>
                    </table>
                    <table>
                        <tr>
                            <td>@Resource.String1030</td>
                            <td></td>
                            <td></td>
                            <td id="ZB_Total"></td>
                            <td>@Resource.String1025/㎡</td>
                        </tr>
                        <tr>
                            <td>@Resource.String1031</td>
                            <td colspan="2">
                                <select id="seleect_code">
                                </select>
                            </td>
                            <td><span id="ERP">0</span>@Resource.String1025</td>
                        </tr>
                    </table>
                </fieldset>
                <fieldset class="boun" id="lax">
                    <legend class="len1 jskapll">@Resource.String1032</legend>
                    <table class="cheshuang">
                        <tbody>
                            <tr>
                                <td>@Resource.String1033</td>
                                <td>
                                    <select id="KOKOM">
                                        @foreach (var item in ViewBag.JX as List<JICH>)
                                        {

                                            if (item.JICH_One.Contains("水印"))
                                            {
                                                <option value="@item.JCCH_C*@item.JiCH_K">@item.JICH_One</option>
                                            }
                                        }
                                        <option value="0*0">水印圆模</option>
                                    </select>
                                </td>
                                <td>@Resource.String1034：<span></span></td>
                                <td>@Resource.String1035：<span></span></td>
                                <td>@Resource.String1036：<span></span></td>
                            </tr>
                        </tbody>

                    </table>
                    <table>
                        <tr>
                            <td colspan="2">
                                @Resource.String1037:
                                <span id="CJIND"></span>
                            </td>
                            <td colspan="2">
                                @Resource.String1038:
                                <span id="KJIND"></span>
                            </td>
                        </tr>
                        <tr>
                            <td>@Resource.String1039：</td>
                            <td>
                                <span id="minajisg"></span>㎡
                            </td>
                            <td class="pingmo">@Resource.String1040</td>
                            <td class="pingmo">
                                <input type="number" min="1" id="yihchuj" value="1" />
                            </td>
                            <td>@Resource.String1041：</td>
                            <td>
                                <span id="minlps"></span>㎡
                            </td>
                        </tr>
                        <tr>
                            <td>@Resource.String1042</td>
                            <td>
                                <span id="kojnnd">0</span>@Resource.String1025/㎡
                            </td>
                            <td>@Resource.String1043</td>
                            <td>
                                <span id="kojjik"></span>@Resource.String1025
                            </td>
                            <td class="Yinfc1" style="display:none">@Resource.String1044</td>
                            <td class="Yinfc1" style="display:none">
                                <input type="number" id="kojG" value="" />
                            </td>
                        </tr>
                        <tr class="LAjidnds" style="display:none">
                            <td>@Resource.String1045</td>
                            <td>
                                <select class="kosml">
                                    <option value="">@Resource.String1046</option>
                                    <option value="1">@Resource.String1047</option>
                                    <option value="2">@Resource.String1048</option>
                                </select>
                            </td>
                            <td><input type="number" class="kosmled" value="" min="0" /></td>
                            <td><span></span>@Resource.String1025/㎡</td>
                            <td class="CY_ts"></td>
                        </tr>
                        <tr class="LAjidnd" style="display:none">
                            <td></td>
                            <td>@Resource.String1049</td>
                            <td>@Resource.String797 (m)</td>
                            <td>@Resource.String1050</td>
                        </tr>
                        <tr class="LAjidnd" style="display:none">
                            <td>
                                <select style="width:100px;height:25px" id="CY_GfAW">
                                    <option value="">@Resource.String1051</option>
                                    @foreach (var item in ViewBag.Yinshua as List<libray>)
                                    {
                                        if (item.ST_ID == 1019 && item.LB_fne == "胶带(拉链箱)")
                                        {
                                            <option value="@item.LB_jia">@item.LB_fne</option>
                                        }
                                    }
                                </select>
                            </td>
                            <td></td>
                            <td></td>
                            <td class="CY_t"></td>
                        </tr>
                        <tr class="LAjidnd" style="display:none">
                            <td>
                                <select style="width:100px;height:25px" id="Yshidai">
                                    <option value="">@Resource.String1051</option>
                                    @foreach (var item in ViewBag.Yinshua as List<libray>)
                                    {
                                        if (item.ST_ID == 1019 && item.LB_fne == "易斯带(拉链箱)")
                                        {
                                            <option value="@item.LB_jia">@item.LB_fne</option>
                                        }
                                    }
                                </select>
                            </td>
                            <td></td>
                            <td></td>
                            <td class="CY_t"></td>
                        </tr>
                        <tr style="display:none">
                            <td>@Resource.String1052</td>
                            <td id="weishi"></td>
                        </tr>
                    </table>
                </fieldset>
                <fieldset class="boun" id="shc">
                    <legend class="len1">@Resource.String1053</legend>
                    <table id="SHENc">
                        <tfoot>
                            <tr>
                                <td>@Resource.String1054</td>
                                <td></td>
                                <td>
                                    <select id="SY_bz" style="width:100px;height:25px" class="GONY">
                                        <option value="">@Resource.String1051</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 5 && item.LB_fne.Contains("防"))
                                            {
                                                <option value="@item.LB_jia">@item.LB_fne</option>
                                            }
                                        }
                                        <option value="">@Resource.String1054</option>
                                        <option value="">人工</option>
                                    </select>
                                </td>
                                <td></td>
                                <td>@Resource.String1025/m</td>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>@Resource.String1056</td>
                                <td></td>
                                <td>
                                    <select id="SY_jis" style="width:100px;height:25px" class="GONY">
                                        <option value="">@Resource.String1051</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 21)
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                        <option value="jiehe">@Resource.String1057</option>
                                    </select>
                                </td>
                                <td></td>
                                <td>@Resource.String1025/M</td>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>@Resource.String1058</td>
                                <td></td>
                                <td>
                                    <select id="SY_MU" style="width:100px;height:25px" class="GONY">
                                        <option value="">@Resource.String1051</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 22)
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td></td>
                                <td>@Resource.String1025/㎡</td>
                                <td></td>
                                <td></td>
                            </tr>
                        </tfoot>
                        <thead>
                            <tr>
                                <td>@Resource.String1045：</td>
                                <td>
                                    <select>
                                        <option value="value">@Resource.String1060</option>
                                        <option value="value">@Resource.String1061</option>
                                    </select>
                                </td>
                                <td>
                                    <select id="Yanse" style="width: 100px;" class="GONY">
                                        <option value="">@Resource.String1062</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.LB_Zlei == "印刷(开槽)")
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td></td>
                                <td>@Resource.String1025/㎡</td>
                                <td></td>
                                <td class="sjinfKKM" style="color:blue">@Resource.String1063</td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>@Resource.String1064</td>
                                <td>
                                    <select>
                                        <option value="value">@Resource.String1060</option>
                                        <option value="value">@Resource.String1061</option>
                                    </select>
                                </td>
                                <td>
                                    <select id="SY_seld" style="width: 100px;" class="GONY">
                                        <option value="">@Resource.String1062</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 2 && item.LB_fne.Contains("防"))
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                        <option value="jiehe">@Resource.String1057</option>
                                    </select>
                                </td>
                                <td></td>
                                <td>@Resource.String1025/㎡</td>
                                <td></td>
                                <td class="LPMMJ" style="color:blue">@Resource.String1063</td>
                            </tr>
                        </tbody>
                    </table>
                    <table>
                        <tr>
                            <td>@Resource.String1065</td>
                            <td id="Zongjis"></td>
                        </tr>
                    </table>
                </fieldset>
                <fieldset class="boun" id="shuangmina">
                    <legend class="len1">@Resource.String1066</legend>
                    <table style="text-align:center">
                        <thead>
                            <tr>
                                <th colspan="3">
                                    @Resource.String1067：
                                    <input type="number" id="shufn_sed" value="" min="0" />米
                                </th>
                            </tr>
                            <tr>
                                <th>@Resource.String1068</th>
                                <th>@Resource.String1069 (M)</th>
                                <th>@Resource.String1070</th>
                                <th>@Resource.String801</th>
                                <th>@Resource.String1071</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    <select style="width:100px;height:25px" id="CY_Gf" class="CYFL">
                                        <option value="">@Resource.String1051</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 1019 && item.LB_fne == "双面胶")
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td><span></span>@Resource.String1025</td>
                                <td><input type="number" value="0.2" class="ShuangM" /></td>
                                <td><input type="number" value="1" class="ShuangM" /></td>
                                <td class="CY_tingfqs"></td>
                            </tr>
                            <tr>
                                <td>
                                    <select style="width:100px;height:25px" id="CY_Gf" class="CYFL">
                                        <option value="">@Resource.String1051</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 1019 && item.LB_fne == "撕拉条")
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td><span></span>@Resource.String1025</td>
                                <td><input type="number" value="0.2" class="ShuangM" /></td>
                                <td><input type="number" value="1" class="ShuangM" /></td>
                                <td class="CY_tingfqs"></td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td>@Resource.String1065：</td>
                                <td></td>
                                <td id="okkoskse"></td>
                            </tr>
                        </tfoot>
                    </table>
                </fieldset>
                <fieldset class="boun" id="miji">
                    <legend class="len1">@Resource.String1072</legend>
                    <table>
                        <tr>
                            <td>@Resource.String1073</td>
                            <td>
                                <select id="Dao_m">
                                    <option value="">@Resource.String1074 </option>
                                    @foreach (var item in ViewBag.Yinshua as List<libray>)
                                    {
                                        if (item.ST_ID == 2016)
                                        {
                                            <option value="@item.LB_jia">@item.LB_fne</option>
                                        }
                                    }
                                </select>
                            </td>
                            <td></td>
                            <td>@Resource.String1025/㎡</td>
                        </tr>
                        <tr class="nichang" style="display:none"> <td>印刷比例</td><td><input type="number" id="bilish" value="" />%</td><td><span></span>@Resource.String1025/㎡</td></tr>
                        <tr>
                            <td>@Resource.String1075</td>
                            <td id="mianjiaMO"></td>
                            <td>㎡</td>
                        </tr>
                        <tr>
                            <td>@Resource.String1065</td>
                            <td id="zhongjiseMO"></td>
                            <td>@Resource.String1025</td>
                        </tr>
                    </table>
                </fieldset>
                <fieldset class="boun guanli">
                    <legend class="len1">@Resource.String1076</legend>
                    <table>
                        <tr>
                            <td>@Resource.String1077：</td>
                            <td>
                                <input type="number" value="5" min="0" class="Guani_s" style="width:130px;" />%
                            </td>
                            <td id="Giuanlifei"></td>
                        </tr>

                    </table>
                </fieldset>
                <fieldset class="boun guanli">
                    <legend class="len1">@Resource.String1078</legend>
                    <table>
                        <tr>
                            <td>@Resource.String1079：</td>
                            <td colspan="2"><input type="text" id="YunFBz" value="" style="width:200px;" /></td>
                            <td style="color:red">@Resource.String1080！</td>
                        </tr>
                        <tr>
                            <td>@Resource.String1081</td>
                            <td>
                                <select id="YUnshijdj">
                                    <option value="">@Resource.String1082</option>
                                    @foreach (var item in ViewBag.Yun as List<Yunshu>)
                                    {
                                        <option value="@item.FPrice">@item.FName</option>
                                    }
                                    <option>省外</option>
                                </select>
                            </td>
                            <td></td>
                            <td>@Resource.String1025/m³</td>
                        </tr>
                        <tr>
                            <td>@Resource.String1083</td>
                            <td id="tijishu"></td>
                            <td>m³</td>
                        </tr>
                        <tr>
                            <td>@Resource.String1065</td>
                            <td id="Yuhn_s"></td>
                        </tr>
                    </table>
                </fieldset>
                <table>
                    <tr>
                        <td>@Resource.String1065：</td>
                        <td id="zjoaqpll"></td>
                        <td></td>
                        <td>@Resource.String1072：</td>
                        <td id="Mujufai"></td>
                    </tr>
                </table>
            </fieldset>
        </form>
        <button id="Tui" class="btn btn-link quxshud quxshudt">@Resource.String363</button>
        <button id="Quebec" class="btn btn-link quxshud quxshudq">@Resource.String373</button>
    </div>

    <div id="CY_divs" style="display: none; overflow: auto; height: 600px;overflow-x:hidden">
        <form class=" padtop biao1">
            <fieldset class="boun" style="width:100%; padding-left:12px;">
                @*彩印纸箱*@
                <fieldset class="boun">
                    <legend class="len1">@Resource.String48</legend>
                    <table title="@Resource.String450">
                        @*彩印纸箱的基本信息 && @item.LB_fne.Length<3*@
                        <tr>
                            <td>@Resource.String001</td>
                            <td id="NAmeoked"></td>
                            <td>@Resource.String1011</td>
                            <td id="BUJianed"></td>
                        </tr>
                        <tr class="leibhu">
                            <td>@Resource.String104</td>
                            <td></td>
                            <td>@Resource.String105</td>
                            <td></td>
                        </tr>
                        <tr class="MIaoshud_C">
                            <td>描述：</td>
                            <td></td>
                            <td>原材料：</td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>@Resource.String1012：</td>
                            <td>
                                <select id="ZB_msed">
                                    @foreach (var item in ViewBag.ListZBxx as List<libray>)
                                    {
                                        if (@item.ST_ID == 10 && @item.LB_fne.Length < 3)
                                        {
                                            <option value="@item.LB_fne">@item.LB_fne</option>
                                        }
                                    }
                                    <option value="N/A">N/A</option>
                                </select>
                            </td>
                            <td>@Resource.String1013</td>
                            <td id="ZB_HDed"></td>
                        </tr>
                        <tr>
                            <td>@Resource.String1014：</td>
                            <td>
                                <select id="Lei_xined">
                                    <option value="1">有底无盖箱</option>
                                    <option value="2">普通开槽箱</option>
                                    <option value="3">全叠盖开槽箱</option>
                                    <option value="4">pizza盒型</option>
                                    <option value="5">异型箱</option>
                                </select>
                            </td>
                            <td> @Resource.String1085：</td>
                            <td id="nianshun"></td>
                        </tr>
                        <tr id="GUigesedse">
                            <td>@Resource.String1014:</td>
                            <td>
                                @Resource.String1016：
                                <input type="number" name="CYJK" value="" min="0" style="width:100px;" class="zhnagkaied" />
                            </td>
                            <td>
                                @Resource.String1017：
                                <input type="number" name="CYJK1" value="" min="0" style="width:100px;" class="zhnagkaied" />
                            </td>
                            <td>
                                @Resource.String1018：
                                <input type="number" name="CYJK2" value="" min="0" style="width:100px;" class="zhnagkaied" />
                            </td>
                        </tr>
                        <tr style="display:none">
                            <td>@Resource.String1014:</td>
                            <td>
                                @Resource.String1016：
                                <input type="number" id="CY_C" name="S_num1" />
                            </td>
                            <td>
                                @Resource.String1017：
                                <input type="number" id="CY_K" name="S_num2" />
                            </td>
                            <td>
                                @Resource.String1018：
                                <input type="number" id="CY_G" name="S_num3" />
                            </td>
                        </tr>
                        <tr>
                            <td>@Resource.String1020：</td>
                            <td colspan="2">
                                <input type="number" id="CY_ZKC" value="" min="0" style="width:130px;" />*
                                <input type="number" id="CY_ZKK" value="" min="0" style="width:130px;" />
                            </td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>@Resource.String1021</td>
                            <td id="Tijiande"></td>
                            <td>@Resource.String1086&nbsp;&nbsp;<input type="checkbox" id="shidjdi" value="" /></td>
                            <td> <div>@Resource.String1104<input type="checkbox" class="lPsKO" value="" id="IPsOKED" /></div></td>
                            <td> <div>取ERP水印纸箱价格（与是否+1连用）<input type="checkbox" id="SyMbS" value="" /></div></td>
                        </tr>
                    </table>
                    <hr />
                    <table>
                        <tr>
                            <td>@Resource.String1027</td>
                            <td>
                                <select class="ZB_CSed" style="width:120px;">
                                    <option>—@Resource.String63—</option>
                                    @foreach (var item in ViewBag.ListPP as List<parice>)
                                    {
                                        if (@item.PA_Shuxing == 5 && (@item.PA_LengBie == "白底白板" || @item.PA_LengBie == "白卡" || @item.PA_LengBie == "灰底白板" || @item.PA_LengBie == "双胶纸" || @item.PA_LengBie == "铜版纸" || @item.PA_LengBie == "白卡（牛皮）" || @item.PA_LengBie == "黑卡（牛皮）" || @item.PA_LengBie == "美卡" || @item.PA_LengBie == "A" || @item.PA_LengBie == "AAA" || @item.PA_LengBie == "面底纸"))
                                        {
                                            <option value="@item.PA_LengBie">@item.PA_LengBie</option>
                                        }
                                    }
                                </select>
                            </td>
                            <td>
                                <select id="SHUAN" style="width:300px;" class="ZB_KZed">
                                </select>
                            </td>
                            <td></td>
                            <td class="ZB_Minazhi_Price" id="ZAQWsx"></td>
                        </tr>
                    </table>
                    <table id="ZB_ZC_tabled">
                        <thead>
                        </thead>
                        <tbody id="ZB_XZC">
                        </tbody>
                        <tfoot>
                            <tr>
                                <td>@Resource.String1028</td>
                                <td>
                                    <select class="ZB_CSed" style="width:120px;">
                                        <option>—@Resource.String63—</option>
                                        @foreach (var item in ViewBag.ListPP as List<parice>)
                                        {
                                            if (@item.PA_Shuxing == 5 && @item.PA_LengBie.Contains("瓦"))
                                            {
                                                <option value="@item.PA_LengBie">@item.PA_LengBie</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td>
                                    <select class="ZB_KZed " style="width:300px;">
                                    </select>
                                </td>
                                <td></td>
                                <td class="ZB_Unit_priced"></td>
                            </tr>
                            <tr>
                                <td>@Resource.String1029</td>
                                <td>
                                    <select class="ZB_CSed" style="width:120px;">
                                        <option>—@Resource.String63—</option>
                                        @foreach (var item in ViewBag.ListPP as List<parice>)
                                        {
                                            if (@item.PA_Shuxing == 5)
                                            {
                                                <option value="@item.PA_LengBie">@item.PA_LengBie</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td>
                                    <select class="ZB_KZed" style="width:300px;">
                                    </select>
                                </td>
                                <td></td>
                                <td class="ZB_Unit_priced"></td>
                            </tr>
                        </tfoot>
                    </table>
                </fieldset>
                <fieldset class="boun">
                    <legend class="len1">@Resource.String1027</legend>

                    <table id="CY_shu" style="overflow:scroll;">
                        <thead>
                            <tr>
                                <td>@Resource.String1088</td>
                                <td>@Resource.String1089</td>
                                <td>@Resource.String1090</td>
                                <td>@Resource.String1036</td>
                                <td>@Resource.String1091</td>
                                <td style="display:none">@Resource.String1092</td>
                                <td style="display:none">@Resource.String1093</td>
                                <td>@Resource.String1094</td>
                                <td>@Resource.String1095</td>
                                <td style="display:none">@Resource.String1096</td>
                                <td>@Resource.String1097</td>
                            </tr>
                        </thead>
                        <tbody id="CY_xian">
                            <tr>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td>
                                    <input type="number" id="CY_ge" value="1" min="0" style="width:50px;" />
                                </td>
                                <td></td>
                                <td style="display:none">
                                    <input type="number" id="CY_tj" value="" min="0" style="width:80px;" />
                                </td>
                                <td style="display:none">
                                    <input type="number" id="CY_kez" value="" min="0" style="width:80px;" />
                                </td>
                                <td></td>
                                <td></td>
                                <td style="display:none">
                                    <input type="number" id="CY_Lenz" value="1.44" min="0" style="width:80px;" />
                                </td>
                                <td></td>
                            </tr>
                        </tbody>
                        <tfoot>
                        </tfoot>
                    </table>
                </fieldset>
                <fieldset class="boun">
                    <legend class="len1">@Resource.String1099</legend>
                    <table>
                        <tr>
                            <td> @Resource.String1100 </td>
                            <td>
                                <select id="shundijk">
                                    @foreach (var item in ViewBag.JX as List<JICH>)
                                    {
                                        if (item.id != 1002)
                                        {
                                            <option value="@item.JCCH_C * @item.JiCH_K*@item.SC_SJ">@item.JICH_One</option>
                                        }
                                    }
                                </select>
                            </td>
                            <td>
                                @Resource.String1034：
                                <span id="JCSCH_C"></span>
                            </td>
                            <td>
                                @Resource.String1035：
                                <span id="JCSCH_K"></span>
                            </td>
                            <td>
                                @Resource.String1101：
                                <span id="JCSCH_cd"></span>
                            </td>
                            <td>
                                @Resource.String1102：
                                <span id="BZ_jieti"></span>
                            </td>
                            <td>
                                @Resource.String1103：
                                <span id="JCSCH_Pic"></span>
                            </td>
                        </tr>
                    </table>
                </fieldset>
                @*材料合计*@
                <fieldset class="boun">
                    <legend class="len1">楞纸成本</legend>
                    <table>
                        <tr>
                            <td>楞纸长：</td>
                            <td id="LenzhiC"></td>
                            <td>楞纸宽：</td>
                            <td id="LenzhiK"></td>
                            <td>楞纸面积：</td>
                            <td id="LenzhiS"></td>
                        </tr>
                        <tr>
                            <td>@Resource.String1023</td>
                            <td>
                                <span id="ZB_shed"></span>&nbsp;%
                            </td>
                            <td>@Resource.String1024</td>
                            <td>
                                <span id="jiahjoksed"></span>&nbsp;@Resource.String1025
                            </td>
                            <td>@Resource.String1026</td>
                            <td>
                                <span id="ZB_jgfed"></span>&nbsp;@Resource.String1025/㎡
                            </td>
                        </tr>
                        <tr>
                            <td>@Resource.String799</td>
                            <td id="ZB_Total_priced"></td>
                            <td>@Resource.String1025/㎡</td>
                            <td>@Resource.String1031</td>
                            <td>
                                <select id="seleect_de">
                                </select>
                            </td>
                            <td><span id="CY_ERP">0</span>@Resource.String1025</td>
                        </tr>
                        <tr>
                            <td colspan="2"> @Resource.String800</td>
                            <td>
                                <span id="Zjgkgond"></span>@Resource.String1025
                            </td>
                        </tr>
                    </table>
                </fieldset>

                <fieldset class="boun jinyong">
                    <legend class="len1">@Resource.String1009</legend>
                    <table id="SJINNS">
                        <tfoot>
                            <tr>
                                <td colspan="9">
                                    <table id="BiaojsnLm">
                                        <tr>
                                            <td>@Resource.String1106</td>
                                            <td style="width:15%">
                                            </td>
                                            <td>
                                                <select id="YS_GESHI" style="width:82px;" class="YS_GFESHI">
                                                    <option value="">@Resource.String1051</option>
                                                    @foreach (var item in ViewBag.Yinshua as List<libray>)
                                                    {
                                                        if (item.LB_fne == "裱楞")
                                                        {
                                                            <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                                        }
                                                    }
                                                </select>
                                            </td>
                                            <td>
                                                <span></span>&nbsp;/㎡
                                            </td>
                                            <td style="width:17%"></td>
                                            <td>
                                                @Resource.String1114：
                                                <span class="YKO_ko"></span>
                                            </td>
                                            <td class="BiaolenB" style="color: blue">添加</td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td>@Resource.String1058</td>
                                <td></td>
                                <td>
                                    <select id="YS_GESHI" style="width:82px;" class="YS_GFESHI">
                                        <option value="">@Resource.String1051</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.LB_fne == "模切")
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td>
                                    <span></span>&nbsp;/㎡
                                </td>
                                <td></td>
                                <td>
                                    @Resource.String1114：
                                    <span class="YKO_ko"></span>
                                </td>
                            </tr>
                            <tr>
                                <td>@Resource.String1056</td>
                                <td></td>
                                <td>
                                    <select id="YS_GESHIwds" style="width:82px;" class="YS_GFESHI">
                                        <option value="">@Resource.String1051</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 1020)
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td><span></span>&nbsp;/m</td>
                                <td></td>
                                <td>
                                    @Resource.String1114：
                                    <span class="YKO_ko"></span>
                                </td>
                            </tr>
                        </tfoot>
                        <thead>
                            <tr>
                                <td>@Resource.String1109</td>
                                <td>
                                    <select>
                                        <option value="1">@Resource.String1060</option>
                                        <option value="2">@Resource.String1061</option>
                                    </select>
                                </td>
                                <td>
                                    <select id="YS_GESHI" style="width:82px;" class="YS_GFESHI">
                                        <option value="">@Resource.String1051</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 1 && (item.LB_fne == "彩印印刷" || item.LB_fne == "一色印刷" || item.LB_fne == "二色印刷" || item.LB_fne == "三色印刷" || item.LB_fne == "满版印刷"))
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td>
                                    <span></span>&nbsp;/@Resource.String1110/张
                                </td>
                                <td>
                                    @Resource.String1111：
                                    <input type="number" class="kokok">
                                </td>
                                <td>
                                    @Resource.String1114：
                                    <span class="YKO_ko"></span>
                                </td>
                                <td class="KOMMm" style="color:blue">@Resource.String1063</td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>@Resource.String1064</td>
                                <td>
                                    <select>
                                        <option value="1">@Resource.String1060</option>
                                        <option value="2">@Resource.String1061</option>
                                    </select>
                                </td>
                                <td>
                                    <select id="YS_GESHI" style="width:82px;" class="YS_GFESHI">
                                        <option value="">@Resource.String1051</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 2 && (item.LB_fne != "防水" && item.LB_fne != "防静电油墨" && item.LB_fne != "表面上油"))
                                            {
                                                <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td>
                                    <span></span>&nbsp;/㎡
                                </td>
                                <td></td>
                                <td>
                                    @Resource.String1114：
                                    <span class="YKO_ko"></span>
                                </td>
                                <td class="LLPKKDD" style="color:blue">@Resource.String1063</td>
                            </tr>
                        </tbody>
                    </table>
                    <table>
                        <tr>
                            <td>@Resource.String1065</td>
                            <td id="CYst">0</td>
                        </tr>
                    </table>
                </fieldset>
                <fieldset class="boun">
                    <legend class="len1">@Resource.String1112</legend>
                    <table style="text-align:center">
                        <thead>
                            <tr>
                                <th>@Resource.String1113</th>
                                <th>@Resource.String1114</th>
                                <th>@Resource.String1115</th>
                                <th>@Resource.String1180</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    <select style="width:100px;height:25px" id="CY_Gongf" class="CYFZL">
                                        <option value="">无</option>
                                        <option value="">@Resource.String1117</option>
                                        <option value="">@Resource.String1118</option>
                                        <option value="">@Resource.String1119</option>
                                        <option value="">@Resource.String1120</option>
                                    </select>
                                </td>
                                <td>
                                    <input type="number" class="CY_jgf" style="width:100px;height:25px" placeholder="@Resource.String1121" />
                                </td>
                                <td>
                                    <input type="number" class="CY_jgh" style="width:100px;height:25px" value="1" min="0" />
                                </td>
                                <td>
                                    <input type="number" class="CY_GOF" style="width:100px;height:25px" value="0.1" min="0" />
                                </td>
                                <td>
                                    <a href="#" id="CY_JGFH">@Resource.String1063</a>
                                </td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <th>@Resource.String1122</th>
                                <th id="CYL_jgf">0</th>
                            </tr>
                        </tfoot>
                    </table>
                </fieldset>
                <fieldset class="boun jinyong">
                    <legend class="len1">@Resource.String1066</legend>
                    <table style="text-align:center">
                        <thead>
                            <tr>
                                <th colspan="3">
                                    @Resource.String1067：
                                    <input type="number" id="shufn_s" value="0" min="0" class="JINDDD" />米
                                </th>
                            </tr>
                            <tr>
                                <th>@Resource.String1068</th>
                                <th>@Resource.String1069</th>
                                <th>@Resource.String1070</th>
                                <th>数量</th>
                                <th>@Resource.String1071</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    <select style="width:100px;height:25px" id="CY_tingf" class="CYSFL">
                                        <option value="">@Resource.String1062</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 1019 && item.LB_fne == "双面胶")
                                            {
                                                <option value="@item.LB_jia">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td><span></span>@Resource.String1025/M</td>
                                <td><input type="number" value="0.2" min="0" class="JINDDD" /></td>
                                <td><input type="number" value="1" min="0" class="JINDDD" /></td>
                                <td class="CY_tingf"></td>
                            </tr>
                            <tr>
                                <td>
                                    <select style="width:100px;height:25px" id="CY_tingf" class="CYSFL">
                                        <option value="">@Resource.String1062</option>
                                        @foreach (var item in ViewBag.Yinshua as List<libray>)
                                        {
                                            if (item.ST_ID == 1019 && item.LB_fne == "撕拉条")
                                            {
                                                <option value="@item.LB_jia">@item.LB_fne</option>
                                            }
                                        }
                                    </select>
                                </td>
                                <td><span></span>@Resource.String1025/M</td>
                                <td><input type="number" value="0.2" min="0" class="JINDDD" /></td>
                                <td><input type="number" value="1" min="0" class="JINDDD" /></td>
                                <td class="CY_tingf"></td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td>@Resource.String1065：</td>
                                <td></td>
                                <td id="okkosk">0</td>
                            </tr>
                        </tfoot>
                    </table>
                </fieldset>

                <fieldset class="boun">
                    <legend class="len1">@Resource.String1054</legend>
                    <table style="text-align:center">
                        <thead>
                            <tr>
                                <th>@Resource.String1123</th>
                                <th>@Resource.String1124</th>
                                <th>@Resource.String1125</th>
                                <th>@Resource.String1065</th>
                            </tr>
                        </thead>

                        <tr>
                            <td>@Resource.String1054</td>
                            <td>
                                <select id="CY_baoz" style="width:200px;height:25px">
                                    <option value="">@Resource.String1051</option>
                                    <option value="S">包装费用</option>
                                    @foreach (var item in ViewBag.Yinshua as List<libray>)
                                    {
                                        if (item.ST_ID == 5)
                                        {
                                            <option value="@item.LB_jia">@item.LB_fne</option>
                                        }
                                    }
                                </select>
                            </td>
                            <td style="width:300px;"><span></span>@Resource.String1025/㎡</td>
                            <td id="CY_baozs"></td>
                        </tr>
                        <tfoot>
                            <tr>
                                <td>@Resource.String1065：</td>
                                <td id="CYY_jsijn">0</td>
                            </tr>
                        </tfoot>
                    </table>
                </fieldset>
                <fieldset class="boun">
                    <legend class="len1">@Resource.String1129</legend>
                    <table id="KOmWSl">
                        <tbody>
                            <tr>
                                <td style="width:30px;"><input type="radio" name="Weiyyi" style="width:30px;" class="Jinhsu" /></td>
                                <td style="width:260px;">@Resource.String1127：</td>
                                <td><input type="number" value="0" class="KMsjnd" />/@Resource.String1128</td>
                                <td style="display:none">@Resource.String1129</td>
                                <td style="display:none"><input type="number" name="name" value="3000" class="Jieti" /></td>
                                <td>损耗：<span></span></td>
                                <td>@Resource.String796 <span class="Avgpris"></span></td>
                                <td><span class="SJFtiajn">添加</span></td>
                            </tr>
                        </tbody>
                        <tfoot><tr><td>合计 <span class="Avgpri"></span></td></tr></tfoot>
                    </table>
                </fieldset>
                <div style="display:none">
                    @Resource.String1131（3%）：
                    <label id="CY_shuan"></label>
                </div>
                <div class="row">
                    <h4>
                        @Resource.String1132：
                        <label id="shugnd" style="display:none"></label>
                        <label id="shugndwsq"></label>
                    </h4>
                </div>
            </fieldset>
        </form>
        <button id="Tui_Cy" class="btn btn-link quxshud quxshudt">@Resource.String363</button>
        <button id="CY_Quebec" class="btn btn-link quxshud quxshudq">@Resource.String373</button>
    </div>
</div>
@*木制品
    1.添加分类（木托和木箱的损耗分类）
    2.根据
*@
<div style="display: none; overflow: auto; height: 600px;" id="jsmb" class="jsmb Dyang-am">
    <div style=" width: 100%; background-color: #bacee9;" class="Tuodong"><span>点击这里拖动窗体</span></div>
    <table>
        <tr>
            <td style="width:20px;">@Resource.String1034</td>
            <td>
                <input type="number" id="MZ_C" disabled />
            </td>
            <td style="width:20px;">@Resource.String1035</td>
            <td>
                <input type="number" id="MZ_K" disabled />
            </td>
            <td style="width:20px;">@Resource.String1018</td>
            <td>
                <input type="number" id="MZ_G" disabled />
            </td>
            <td>
                <select id="MUTO">
                    <option value="1">@Resource.String1133</option>
                    <option value="2">@Resource.String1134</option>
                </select>
            </td>
            <td><input type="number" value="" id="SHJNK" style="width:50px" />&nbsp;%</td>
            <td class="ksmwww">0</td>
        </tr>
    </table>

    <fieldset class=" boun">
        <legend class="len1">@Resource.String1135</legend>
        <table border="0" id="XUANJI">
            <thead>
                <tr>
                    <th rowspan="2">@Resource.String1136</th>
                    <th rowspan="2">@Resource.String1137</th>
                    <th rowspan="2">@Resource.String1138</th>
                    <th colspan="4" style="text-align:center;">@Resource.String1139</th>
                    <th rowspan="2">@Resource.String1140</th>
                    <th rowspan="2">m³</th>
                    <th rowspan="2">@Resource.String1131</th>
                    <th>@Resource.String1141</th>
                    <th>@Resource.String1135</th>
                </tr>
                <tr>
                    <th>@Resource.String1034</th>
                    <th>@Resource.String1035</th>
                    <th>@Resource.String1142</th>
                    <th>@Resource.String1143</th>
                    <th>RMB/m3</th>
                    <th>RMB/pcs</th>
                </tr>
            </thead>
            <tbody id="MZ_MCF" class="MZ_CLJL">
                <tr>
                    <td></td>
                    <td>
                        <input type="text" style="width:60px;height:25px" />
                    </td>
                    <td>
                        <select class="MZ_CL" style="width:130px;height:25px" id="MZ_CL">
                            <option value="0">@Resource.String1144</option>
                            @foreach (var item in ViewBag.parice as List<parice>)
                            {
                                if (item.PA_Shuxing == 1)
                                {
                                    <option value="@item.PA_ZhongL">@item.PA_ZhongL</option>
                                }
                            }
                        </select>
                    </td>
                    <td>
                        <input type="number" class="MZ_gg" id="mz_c" style="width:60px;height:25px" />
                    </td>
                    <td>
                        <input type="number" class="MZ_gg" id="mz_k" style="width:60px;height:25px" />
                    </td>
                    <td>
                        <input type="number" class="MZ_gg" id="mz_g" style="width:60px;height:25px" />
                    </td>
                    <td>
                        <input type="number" class="MZ_gg" id="mz_sj" style="width:60px;height:25px" />
                    </td>
                    <td>
                        <input type="number" class="MZ_gg" id="MZ_shuliang" name="MZ_SL" style="width:60px;height:25px" />
                    </td>
                    <td class="MZ_TJ" id="MZ_TJ"></td>
                    <td id="mz_sh"></td>
                    <td id="mz_lfj"></td>
                    <td class="MZ_MCF" id="MZ_MC"></td>
                    <td>
                        <a href="#" id="MZ_CZ">@Resource.String1063</a>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <th>@Resource.String1122</th>
                    <th colspan="7"></th>
                    <th id="ALL_MCTJ"></th>
                    <th colspan="2"></th>
                    <th id="ALL_MCF"></th>
                </tr>
            </tfoot>
        </table>
    </fieldset>
    <fieldset class=" boun">
        <legend class="len1">@Resource.String1112</legend>
        <table style="text-align:center" border="0">
            <thead>
                <tr>
                    <th>@Resource.String1136</th>
                    <th>名称</th>
                    <th>@Resource.String1140</th>
                    <th>@Resource.String1141</th>
                    <th>@Resource.String1135</th>
                    <th>@Resource.String1116</th>
                </tr>
            </thead>
            <tbody id="MZ_MCF2">
                <tr>
                    <td></td>
                    <td>
                        <select style="width:125px;height:25px" id="MZ_FL">
                            <option value="djdd">@Resource.String1144</option>
                            @foreach (var item in ViewBag.parice as List<parice>)
                            {
                                if (item.PA_Shuxing == 6)
                                {
                                    <option value="@item.PA_T+@item.PA_ZhongL">@item.PA_ZhongL</option>
                                }

                            }
                        </select>
                    </td>
                    <td>
                        <input type="number" style="width:60px;height:25px" id="MZ_FLSL" />
                    </td>
                    <td></td>
                    <td class="MZ_FLF" id="MZ_FLF"></td>
                    <td>
                        <a href="#" id="MZ_FLH">@Resource.String1063</a>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <th>@Resource.String1122</th>
                    <th colspan="3"></th>
                    <th id="ALL_FLF"></th>
                </tr>
            </tfoot>
        </table>
    </fieldset>
    <fieldset class=" boun">
        <legend class="len1">@Resource.String1026</legend>
        <table style="text-align:center" border="0">
            <thead>
                <tr>
                    <th>@Resource.String1146</th>
                    <th>@Resource.String1147</th>
                    <th>@Resource.String1116</th>
                </tr>
                <tr>
                    <td>
                        <select style="width:100px;height:25px" id="MZ_RG">
                            <option value="">@Resource.String72</option>
                            @foreach (var item in ViewBag.ListZBxx as List<libray>)
                            {
                                if (item.ST_ID == 7)
                                {
                                    <option value="@item.LB_jia">@item.LB_fne</option>
                                }

                            }
                        </select>
                    </td>
                    <td id="MZ_RGF"></td>
                </tr>
            </thead>
            <tbody id="gyfffjd">
                <tr>
                    <td>
                        <input type="text" id="MZ_gymc" style="width:100px;height:25px" placeholder="@Resource.String421" />
                    </td>
                    <td>
                        <input type="number" class="MZ_jgf" style="width:100px;height:25px" placeholder="@Resource.String1148" />
                    </td>
                    <td>
                        <a href="#" id="MZ_JGFH">@Resource.String1063</a>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <th>@Resource.String1122</th>
                    <th id="ALL_jgf"></th>
                </tr>
            </tfoot>
        </table>
    </fieldset>
    <fieldset class=" boun">
        <legend class="len1">@Resource.String1149</legend>
        <table>
            <tbody>
                <tr>
                    <td>@Resource.String1149</td>
                    <td>
                        <input type="number" id="MZ_YSF" class="MZ_YS" />
                    </td>
                </tr>
                <tr>
                    <td>@Resource.String1150</td>
                    <td>
                        <input type="number" id="MZ_ZCSL" class="MZ_YS" />
                    </td>
                </tr>
                <tr>
                    <td>@Resource.String1151</td>
                    <td id="MZ_YSFXJ"></td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <fieldset class=" boun">
        <legend class="len1">@Resource.String1152</legend>
        <div>@Resource.String1153<input type="checkbox" id="CFkosmd" value="" /> </div>
        <table border="0">
            <thead>
                <tr>
                    <th colspan="2">@Resource.String1154</th>
                    <th>@Resource.String1155</th>
                    <th>@Resource.String1156</th>
                    <th>@Resource.String1157</th>
                </tr>
            </thead>
            <tbody>
                <tr id="Xinxi">
                    <td>@Resource.String1158：</td>
                    <td>
                        <select id="Ren_chu">
                            <option value="">@Resource.String1051</option>
                            @foreach (var item in ViewBag.ListZBxx as List<libray>)
                            {
                                if (item.ST_ID == 8)
                                {
                                    <option value="@item.LB_shun+@item.LB_jia">@item.LB_fne</option>
                                }
                            }
                        </select>
                    </td>
                    <td id="ehgdbij"></td>
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td>@Resource.String1159</td>
                    <td id="RC_YSFXJ"></td>
                </tr>
            </tbody>
        </table>
    </fieldset>
    <div>
        <p>
            @Resource.String1122：
            <label id="Zongji">0</label>
        </p>
    </div>
    <div>
        <button id="Queding" class="btn-sm btn-dark quxshud quxshudq">@Resource.String373</button>
        <button id="Tuichu" class="btn-sm btn-dark quxshud quxshudt">@Resource.String363</button>
    </div>
</div>
@*塑料*@
<div id="SHUliao" class="jsmb Dyang" style="display: none; overflow: auto; height: 600px;">
    <div style=" width: 100%; background-color: #bacee9;" class="Tuodong"><span>点击这里拖动窗体</span></div>
    <table>
        <tr>
            <td>
                <select id="SL_WLFL">
                    <option value="气泡袋">@Resource.String1160</option>
                    <option value="葫芦膜">@Resource.String1161</option>
                    <option value="气泡枕">@Resource.String1162</option>
                    <option value="缠绕膜">@Resource.String1163</option>
                    <option value="塑料袋">@Resource.String1164</option>
                    <option value="缓冲材">@Resource.String1165</option>
                    <option value="胶带">@Resource.String1166</option>
                    <option value="吸塑">@Resource.String1167</option>
                    <option value="铝箔">@Resource.String809</option>
                </select>
            </td>
        </tr>
    </table>
    <div style="display:block" id="div1">
        <fieldset class="boun">
            <label>@Resource.String1168</label>
            <table id="tab1" style="display:block">
                <thead id="SL_GG">
                    <tr>
                        <td>@Resource.String1016</td>
                        <td><input type="number" class="inp" id="SL_C" /></td>
                        <td>@Resource.String1017</td>
                        <td><input type="number" class="inp" id="SL_K" /></td>
                        <td>@Resource.String1169</td>
                        <td><input type="number" class="inp" id="SL_H" /></td>
                    </tr>
                    <tr>
                        <td>@Resource.String1170</td>
                        <td><input type="number" value="0.92" class="inp" id="SL_M" /></td>
                        <td>@Resource.String1171</td>
                        <td><input type="number" class="inp" id="SL_LLJZ" /></td>
                        <td>实际净重(G)</td>
                        <td><input type="number" class="inp" id="SL_SJZL" /></td>
                    </tr>
                </thead>
            </table>
            <div id="MKJRTY">单面：<input type="checkbox" name="DANMIAN" value="单面" id="KMJLM" /></div>
        </fieldset>
        <fieldset class="boun">
            <legend class="len1">@Resource.String1173</legend>
            <table>
                <thead>
                    <tr>
                        <td>
                            <select id="sl_ms">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>材料名</td>
                        <td>占比</td>
                        <td>吨重</td>
                        <td>实际占用</td>
                    </tr>
                </thead>
                <tbody id="SL_WLZC">
                </tbody>
                <tfoot>
                    <tr>
                        <td>@Resource.String1174</td>
                        <td id="SL_wlkj"></td>
                        <td>@Resource.String1175</td>
                        <td id="SL_wldj"></td>
                        <td>@Resource.String1176</td>
                        <td id="SL_CLF" class="SL_FY_t SL_JD_YF"></td>
                    </tr>
                </tfoot>
            </table>
        </fieldset>
        <fieldset class="boun" style="display:block" id="SL_FLMB">
            <legend class="len1">@Resource.String1112</legend>
            <table id="ZHIT">
                <thead>
                    <tr>
                        <td></td>
                        <td>@Resource.String1112</td>
                        <td>@Resource.String1071</td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><input type="checkbox" value="纸管" class="SL_FLXZ" /></td>
                        <td>@Resource.String1177</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" value="纸箱" class="SL_FLXZ" /></td>
                        <td>@Resource.String1178</td>
                        <td></td>
                    </tr>
                </tbody>
            </table>
            <table id="SL_JGF_3" style="display:none">
                <thead>
                    <tr>
                        <td></td>
                        <td>@Resource.String1071</td>
                        <td>@Resource.String1181</td>
                        <td>@Resource.String1182</td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><input type="checkbox" value="制袋" class="SL_FLXZ" /></td>
                        <td>制袋</td>
                        <td><input id="LB_ZD" type="number" value="3"></td>
                        <td>
                        <td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" value="真空阀" class="SL_FLXZ" /></td>
                        <td>真空阀</td>
                        <td><input id="LB_ZKF" type="number" value='0.5'></td>
                        <td>
                        <td>
                    </tr>
                </tbody>
            </table>
            <table>
                <tfoot>
                    <tr>
                        <td>@Resource.String1179</td>
                        <td id="SL_FLFXJ" class="SL_FY_t"></td>
                    </tr>
                </tfoot>
            </table>
        </fieldset>
        <fieldset class="boun">
            <legend class="len1">@Resource.String1180</legend>
            <table id="SL_JGF_1" style="display:block">
                <thead>
                    <tr>
                        <td>@Resource.String11</td>
                        <td>@Resource.String1071</td>
                        <td>@Resource.String1116</td>
                    </tr>
                </thead>
                <tbody id="SL_JGF_1_2">
                </tbody>
            </table>
            <table id="SL_JGF_2" style="display:none">
                <thead>
                    <tr>
                        <td></td>
                        <td>@Resource.String1071</td>
                        <td>@Resource.String1181</td>
                        <td>@Resource.String1182</td>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
            <table id="SL_JGF_4" style="display:none">
                <thead>
                    <tr>
                        <td></td>
                        <td>@Resource.String1071</td>
                        <td>@Resource.String1181</td>
                        <td>@Resource.String1182</td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td><input type="checkbox" value="辅料加工费" class="FLJGF" /></td>
                        <td>辅料加工费</td>
                        <td><input id="LB_ZKF" type="number" value='0.5'></td>
                        <td><td>
                    </tr>
                </tbody>
            </table>
            <table>
                <tr>
                    <td>@Resource.String1183</td>
                    <td id="SL_JGFXJ" class="SL_FY_t"></td>
                </tr>
            </table>
        </fieldset>
        <fieldset class="boun">
            <legend class="len1">@Resource.String1078</legend>
            <table>
                <thead>
                    <tr>
                        <td>@Resource.String1078</td>
                        <td><input type="number" id="SL_YF" class="inp" /></td>
                    </tr>
                </thead>
                <tfoot>
                    <tr>
                        <td>@Resource.String1184</td>
                        <td id="SL_YFXJ" class="SL_FY_t"></td>
                    </tr>
                </tfoot>
            </table>
        </fieldset>
        <fieldset class="boun">
            <legend class="len1">@Resource.String1185</legend>
            <table>
                <tr>
                    <td>@Resource.String1186</td>
                    <td id="SL_WLZJ1"></td>
                </tr>
            </table>
        </fieldset>
    </div>
    <div id="div2" style="display:none">
        <div>
            <select id="HCC_ZL">
                <option value="0">@Resource.String72</option>
                <option value="1">@Resource.String1187</option>
                <option value="2">@Resource.String1188</option>
            </select>
        </div>
        <table id="HC_CQ" style="display:none">
            <thead>
                <tr>
                    <th>长（mm）</th>
                    <th>@Resource.String1017</th>
                    <th>@Resource.String1018</th>
                    <th>@Resource.String1189</th>
                    <th>@Resource.String1190</th>
                    <th>@Resource.String1140</th>
                    <th>@Resource.String1192</th>
                    <th>@Resource.String1131 %</th>
                    <th>@Resource.String1193</th>
                    <th>@Resource.String1180</th>
                    <th>@Resource.String1195</th>
                    <th>@Resource.String1116</th>
                </tr>
            </thead>
            <tbody id="tab3_tbody">
                <tr>
                    <th>
                        <input type="number" class="HC_GG" id="HC_C" style="width:60px;height:30px" />
                    </th>
                    <th>
                        <input type="number" class="HC_GG" id="HC_K" style="width:60px;height:30px" />
                    </th>
                    <th>
                        <input type="number" class="HC_GG" id="HC_G" style="width:60px;height:30px" />
                    </th>
                    <th>
                        <select id="HC_MD" style="width:60px;height:30px">
                            <option value="">@Resource.String1189</option>
                            @foreach (var item in ViewBag.par as List<parice>)
                            {
                                if (@item.PA_LengBie == "裁切缓冲材")
                                {
                                    <option value="@item.PA_T+@item.PA_ZhongL">@item.PA_ZhongL</option>
                                }

                            }
                        </select>
                    </th>
                    <th></th>
                    <th>
                        <input type="number" class="HC_GG" id="HC_SL" style="width:60px;height:30px" value="1" />
                    </th>
                    <th class="HC_TJ_c"></th>
                    <th>
                        <input type="number" class="HC_GG" id="HC_SH" style="width:60px;height:30px" value="10" />
                    </th>
                    <th class="HC_clf"></th>
                    <th class="HC_jgf"></th>
                    <th class="HC_cb"></th>
                    <th>
                        <a href="#" id="HC_CZ">@Resource.String1063</a>

                    </th>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <th>@Resource.String1186</th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th id="ALL_TJ"></th>
                    <th></th>
                    <th id="ALL_CL_price"></th>
                    <th id="ALL_JG_price"></th>
                    <th id="ALL_CB_price"></th>
                </tr>
            </tfoot>
        </table>
        <table id="HC_FP" style="display:none">
            <thead>
                <tr>
                    <td>
                        <select id="FP_ZL">
                            <option>@Resource.String1196</option>
                            @foreach (var item in ViewBag.par_hc as List<routing>)
                            {
                                <option value="@item.RO_kon">@item.RO_kon</option>

                            }
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>@Resource.String1197</td>
                    <td>@Resource.String1198</td>
                </tr>
            </thead>
            <tbody id="FP_GY_tb">
            </tbody>
            <tfoot>
                <tr>
                    <td>@Resource.String1199</td>
                    <td>
                        <input type="number" id="FP_WLZL" />
                    </td>
                </tr>
                <tr>
                    <td>@Resource.String1200</td>
                    <td id="FP_ZJG"></td>
                </tr>
            </tfoot>
        </table>
    </div>
    <button id="Tui001" class="btn-sm btn-link quxshud quxshudt">@Resource.String363</button>
    <button id="SHULbec" class="btn-sm btn-link quxshud quxshudq">@Resource.String373</button>
</div>

<div style="display:none">
    <div id="wulm"></div>
    <div id="liaoh"></div>
    <div id="flelei"></div>
    <div id="fellei2"></div>
    <div id="bomindy"></div>
</div>
@*新建物料和料号*@
<div id="addwl_main" style="display: none; position: absolute; border: 1px black solid; left: 20%; top: 30%; background-color: white; background-color: #f1f1f1">
    <div style="text-align: right; background-color: #84acde;" class="Tuodong">点击这里拖动窗体<span class="quxiao" style=" margin: 20px;"><i class="bi bi-x-square"></i></span></div>
    <div style="margin: 20px 10px; padding: 10px; background-color: #fff;">
        <table id="addwl_main_tab">
            <tr><td style="color:red">@Resource.String1261</td></tr>
            <tr><td>层级</td><td><select id="LevenED"><option value="Leve0">Leve0</option><option value="leve1">leve1</option><option value="leve2">leve2</option></select></td></tr>
            <tr>
                <td>@Resource.String512<span style="color:red">*</span></td>
                <td><input type="text" id="amt_WLM" class="amt_v" /></td>
                <td>@Resource.String111</td>
                @*料号*@
                <td><input type="text" id="amt_WLBM" class="" readonly /></td>
            </tr>
            <tr>
                <td>@Resource.String112</td>
                <td><input type="number" id="amt_NYL" class="amt_v" /></td>
                <td>@Resource.String113</td>
                <td>
                    <input type="text" name="Biaomian" value="" readonly />
                </td>
            </tr>
            <tr>
                <td>@Resource.String114</td>
                <td><input type="text" id="amt_BMCL" class="amt_v" /></td>
                <td>@Resource.String115</td>
                <td><input type="text" id="amt_YCL" class="amt_v" /></td>
            </tr>
            <tr>
                <td>@Resource.String116 <span style="color:red">*</span></td>
                <td>
                    <input type="text" class="amt_v guig" id="leibei_d" />
                </td>
                <td>@Resource.String120<span style="color:red">*</span></td>
                <td>
                    <input type="text" class="amt_v guig" id="leibei_x" />
                </td>
            </tr>
            <tr>
                <td>@Resource.String123 (mm)<span style="color:red">*</span></td>
                <td><input type="number" class="amt_v guig" id="cahns" /></td>
                <td>*<input type="number" class="amt_v guig" id="cahns1" /></td>
                <td>*<input type="number" class="amt_v guig" id="cahns2" /></td>
            </tr>
            <tr>
                <td>@Resource.String124</td>
                <td><input type="text" id="amt_MS" class="amt_v" /></td>
                <td>计量单位<span style="color:red">*</span></td>
                <td>
                    <input type="text" class="amt_v guig" id="amt_DW" />
                </td>
            </tr>
            <tr>
                <td>自制或外购</td>
                <td>
                    <select id="shuxinss" style="width:100px;">
                        <option value=""></option>
                        <option value="外购">外购</option>
                        <option value="自制">自制</option>
                    </select>
                </td>
            </tr>
        </table>
    </div>
    <div style=" display: flex; justify-content: center;"><button class="Squeding">@Resource.String125</button><button class="quxiao">@Resource.String126</button></div>
    <div style="display:none" id="knds"></div>
</div>

@section scripts{
    <script src="~/Scripts/jquery-3.4.1.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script>

		$(function() {
			if ($("#Shenji").text() == "Y") {
				$('input[name="Sheji"]').removeAttr('disabled')
			}
            $("#lihfh").css({ "color": "black", "background-color": "white" })
			/*$("#li4").css({ "color": "black", "background-color": "white" })*/
			$("#BoTa tr td").addClass("inwei");
			$("#textfieldsd,#textfielded,#textfield").css("width", "120px")
			$("#Gong tr td p").addClass("tbtr1");
			$("#Gong tr td input:text").addClass("Shu1");
			$("#BiaoTo tr td").css("padding", "0.1rem", "padding-left", "0.3rem");
			$("#Gong tbody tr").css("border-bottom", "1px solid rgb(255 80 105 / 73%)");
			$("#YinseWU td input:text").hide();
			$("#Gong tbody tr td:first").css("width", "70px;");
            $(document).on("click", "#Squeding", function () {
                addwuliao()
			})
            function addwuliao() {
                var temp7 = $("#leibei_d").val()
                temp7 = temp7 == "1" ? "纸质" : temp7 == "2" ? "木质" : temp7 == "3" ? "塑料" : temp7 == "4" ? "金属制品" : temp7 == "5" ? "布" : temp7 == "6" ? "胶粘制品" : temp7 == "7" ? "其他" : temp7 == "8" ? "套件" : temp7;
                var GUIGE = "";
                var intkom = $(".guig").length;
                var int = 1;
                $(".guig").each(function (i, gg) {
                    if (intkom > int) {
                        GUIGE += $(gg).val() + "*"
                    } else {
                        GUIGE += $(gg).val()
                    }
                    int++;
                })
                var bm = $("#Login_bm").text()
                var d = 0;
                if (bm == "设计") {
                    d = 1
                }
                else {
                    d = 2
                }
                var JNFM = $("#LevenED").val()
                console.log(JNFM)
                var application = {
                    FM_bai: $("#amt_WLBM").val(),
                    FM_name: $("#amt_WLM").val(),
                    FM_nyl: $('#amt_NYL').val(),
                    FM_zx: $('#date-time').val(),
                    FM_yj: temp7,
                    FM_ej: $('#leibei_x').val(),
                    FM_bmcl: $('#amt_BMCL').val(),
                    FM_ycl: $('#amt_YCL').val(),
                    FM_ms: $('#amt_MS').val(),
                    FM_gg: GUIGE,
                    FM_ji: $("#amt_DW").val(),
                    FM_long: $("#cahns").val(),
                    FM_kuan: $("#cahns1").val(),
                    FM_gao: $("#cahns2").val(),
                    FM_Jieti: $("input[name='Biaomian']").val(),
                    FM_Zhuang: $("#shuxinss").val(),
                    FM_price: d
                };
                console.log(application)

                //bom heding
                if (application.FM_name != "" && application.FM_ej != "" && application.FM_ej != "" && application.FM_gg != "") {
                    if (application.FM_long == "" && application.FM_kuan == "" && application.FM_gao == "") {
                        alert("规格数据不符合要求")
                        return
                    }
                    if (application.FM_Jieti == "") {
                        alert("最小起订量需要选择")
                        return
                    }
                    if (application.FM_Zhuang == "") {
                        alert("物料需要选择自制或外购")
                        return
                    }
                    if (JNFM == "") {
                        alert("请选择物层级！")
                        return
                    }
                    if (temp7 == "0") {
                        alert("请选择物料一级分类！")
                        return
                    }
                    $.ajax({
                        url: "/Application/Addfor",
                        type: "POST",
                        data: { "applications": application, "names": $("#txtdan").val() },
                        success: function (data) {
                            if (data == "修改成功") {
                                location.reload(true)
                            } else if (data == "修改失败") {
                                alert(data)
                            } else {
                                AppendBOMLine()
                            }
                            $("#addwl_main").css({ "display": "none" })
                            $(".amt_v").val("")
                        },
                        error: function () {
                            alert("erroer");
                        },
                    })
                } else {
                    alert("请输入必须字段")
                }
            }
		})
		$(function() {
			gettbz() //搜索备注信息
			//点击切换基础信息，备注信息，图纸沟通
			$(function () {
                $("#CHAKAN").click(function () {
                    var bian = $("#shenDan").text();
                    window.location.href = "/Detailed/BOMView?names=" + bian;
				})
				$("#divjibeng").click(function(e) {
					$("#divsw1").css({
						"display": "block"
					});
					$("#divsw2").css({
						"display": "none"
					});
                    $("#divsw3,#divsw7").css({
						"display": "none"
					});
					$(this).css({
						"background-color": "#fff"
					})
					$(this).siblings().css({
						"background-color": "#ededed"
					})
				})
				$("#divbeizhu").click(function(e) {
					$("#divsw2").css({
						"display": "block"
					});
					$("#divsw1").css({
						"display": "none"
					});
                    $("#divsw3,#divsw7").css({
						"display": "none"
					});
					$(this).css({
						"background-color": "#fff"
					})
					$(this).siblings().css({
						"background-color": "#ededed"
					})
				})
				$("#divtuzhi").click(function(e) {
					$("#divsw3").css({
						"display": "block"
					});
					$("#divsw1").css({
						"display": "none"
					});
                    $("#divsw2,#divsw7").css({
						"display": "none"
					});
					$(this).css({
						"background-color": "#fff"
					})
					$(this).siblings().css({
						"background-color": "#ededed"
					})
				})
                $("#BOMjisn").click(function (e) {
					$("#divsw7").css({
						"display": "block"
					});
                    $("#divsw1,#divsw2,#divsw3").css({
						"display": "none"
					});
					$(this).css({
						"background-color": "#fff"
					})
					$(this).siblings().css({
						"background-color": "#ededed"
					})
				})

			})
			//获取备注信息
			function gettbz() {
				var kan = $("#shenDan").text();
				$.ajax({
					url: "/Application/Application",
					type: "POST",
					data: {
						"App_ban": kan,
						"state": 4
					},
					success: function(sjik) {
						$("#RZ_gwzr div").remove();
						$.each(sjik, function(i, item) {
							var $tr = $(`  <div>
											<div>
												<span style="color:red">${item.B_BR}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>${item.B_Date}</span>
											</div>
											<div style="border-bottom:1px solid #808080">
												${item.B_bei}
											</div>
										</div>`);
							$("#RZ_gwzr").append($tr);
						})
					},
					error: function() {
						alert("erroer");
					},
				})
			}
			//获取图纸信息
			Load_design_table()
			//获取图纸信息
			function Load_design_table() {
				$.ajax({
					url: '/Application/Application',
					type: 'POST',
					data: {
						"state": 3,
						"App_ban": $('#shenDan').text()
					},
					success: function(path) {
						console.log(path)
						createFJ(path)
					},
					error: function() {
						alert("系统错误!");
					}
				})
			}

			function createFJ(fgggh) {
				$("#logfuj tr").remove();
				$("#div3__tb tr").remove();
				var ind1 = 1
				var ind2 = 1
				var temp = 0
				$.each(fgggh, function(i, item) {
					var x = item.De_dizhi
					if (item.DE_lei == "图纸") {
						var $tr = (`
								<tr class="log_tr">
									<td style="display:none">${item.DE_id}</td>
									<td>${ind1}</td>
									<td>${item.De_dizhi}</td>
									<td>${item.bom_id}</td>
									<td>${item.De_shijian}</td>
									<td>${item.De_ren}</td>
									<td>
										<input type="number" readonly="readonly" value="${item.DE_Slong}" style="width:60px;height:30px"/>
									</td>
									<td><a href="#" id="log_SC">删除</a>/<a href="/Contracts/Download_file?path=${x}" id="log_SZ">@Resource.String582</a></td>
								</tr>`);
						$("#div3__tb").append($tr);
						ind1++
						temp += item.DE_Slong * 1
					} else {
						var $tr = (`
								<tr class="log_tr">
									<td style="display:none">${item.DE_id}</td>
									<td>${ind2}</td>
									<td>${item.De_dizhi}</td>
									<td>${item.De_shijian}</td>
									<td>${item.De_ren}</td>
									<td><a href="/Contracts/Download_file?path=${x}" id="log_SZ">@Resource.String582</a></td>
								</tr>`);
						$("#logfuj").append($tr);
						ind2++
					}
				})
				$("#SJ_ZYS").text(temp)
			}
		})
		$(function() {
			//退出按钮
			$("#Tui,#Tui_Cy").click(function() {
				$("#DyangSE").css("display", "none");
			})
			$("#Tui001").click(function() {
				$("#SHUliao").css("display", "none");
			})
			$("input[name='Sheji']").click(function() {
				var DTOn = $("#shenDan").text()
				window.location = "/Contracts/Design_order?DTon=" + DTOn
			})
			//切换纸箱
			$("#Qiehaun").click(function() {
				var shunfji = $("#Qiehaun option:selected").val()
				if (shunfji == "水印纸箱") {
					$("#SY_divs").show()
					$("#CY_divs").hide()
				} else {
					hdhfjjjd()
					$("#SY_divs").hide()
					$("#CY_divs").show()
				}
			})

			$(document).on("click", ".quxshud", function () {
                var bomind= $("#bomindy").text()
                $.ajax({
                    url: '/Material/Index',
                    type: 'POST',
                    data: {
                        "num": bomind,
                        "state": 12
                    },
					success: function (e) {
                    },
                    error: function () {
                        alert("系统错误");
                    }
                })
			})
		})
		var BOM2_ids; //记录bomid的值
		//添加工艺部分
		$(function() {
			//字段分解
			function jidns(guigesdw) {
				//处理字符串
                $.ajax({
                    url: '/Material/GongYiHuiFU',
                    type: 'POST',
                    data: {
                        "Bomid": Intid,
                        "state": 1
                    },
					success: function (e) {
						if (e.length>0) {
                            $.each(e, function (i, item) {
								guigesdw = item.wl_c + "*" + item.wl_k + "*" + item.wl_g
							})
                        }
                        var shunf = guigesdw.replace(/mm/g, "")
                        var shunf = shunf.replace(/ /g, "")
                        var Hund = shunf.split('*');
                        var CYC = Hund[0]
                        var CYK = Hund[1]
                        var CYG = Hund[2]
                        $("#MZ_C,input[name='CYJK'],#SL_C,#SL_gg_C,input[name='SHUNHH']").val(CYC)
                        $("#MZ_K,input[name='CYJK1'],#SL_K,#SL_gg_K,input[name='SHUNHKK']").val(CYK)
                        $("#MZ_G,input[name='CYJK2'],input[name='SHH']").val(CYG)
                    },
                    error: function () {
                        alert("系统错误");
                    }
                })
			}

			function sjidnn(shune) {
				var select2 = document.getElementById("MUTO");
				var shund;
				switch (shune) {
					case "水印纸箱":
					case "水印瓦楞箱":
					case "水印拉链箱":
						$("#DyangSE").css("display", "block");
						$("#SY_divs").css("display", "block");
						$("#CY_divs").css("display", "none");
						break;
					case "彩印纸箱":
						$("#DyangSE").css("display", "block");
						$("#CY_divs").css("display", "block");
						$("#SY_divs").css("display", "none");
						break;
					case "木托盘":
						$("#jsmb").css("display", "block"); //木制品
						for (var i = 0; i < select2.options.length; i++) {
							if (select2.options[i].text == "木托盘损耗") {
								select2.options[i].selected = true;
							}
						}
						hsuhdmkl()
						sxunf()
                        dwddd()
						break;
					case "木箱":
						for (var i = 0; i < select2.options.length; i++) {
							if (select2.options[i].text == "木箱损耗") {
								select2.options[i].selected = true;
							}
						}
						hsuhdmkl()
						sxunf()
                        dwddd()
						$("#jsmb").css("display", "block"); //木制品
						break;
					default:
						alert("类型不明确！")
						break;
				}
			}
			var Intid = 0;

			$(document).on("click", "#DanJe", function(e) {
				//关联数据库 获取主键的值
                Intid = $(e.target).parent().parent().children().eq(1).text() // BOM2_id的值
                var WLliao = $(e.target).parent().parent().children().eq(5).text() //料号
                var wiliaohsjdsd = $(e.target).parent().parent().children().eq(10).text() // 一级分类
                var wiliaoerji = $(e.target).parent().parent().children().eq(10).text() // 二级分类
				BOM2_ids = Intid
                var guige = $(e.target).parent().next().next().text() //规格
                var WLname = $(e.target).parent().parent().children().eq(6).text() //物料名
                var WLLH = $(e.target).parent().parent().children().eq(5).text() //物料名
				var bomind = $(e.target).parent().parent().children().eq(1).text()
				var name = $("#Login_N").text()
				$("#bomindy").text(Intid)
                $.ajax({
                    url: '/Material/Index',
                    type: 'POST',
                    data: {
                        "num": bomind,
                        "state": 11,
                        "Zongjsia": name
                    },
                    success: function (e) {
						if (e != "ghgh") {
							if (wiliaohsjdsd == "3") {
								$("#SHUliao").show()
							}
							else {
								sjidnn(shune)
								if (wiliaohsjdsd == "2") {
                                    $.ajax({
                                        url: "/Material/Index",
                                        type: "POST",
                                        data: {
                                            "state": 9,
                                            "BOM2_liao": bomind
                                        },
										success: function (s) {
											if (s != null) {
												$("#MZ_YSF").val(s.wl_mj)
												$("#MZ_ZCSL").val(s.wl_ll)
												$("#MZ_YSFXJ").text(s.wl_sj)
												$("#Ren_chu").val(s.wl_leng)
												$("#RC_YSFXJ").text(s.wl_m)
												$("#Zongji").text(s.wl_h)
                                                if (egfj != null && egfj != "无" && egfj!="") {
													var egfj = s.wl_leng.split("+")
													$("#ehgdbij").text(egfj[1])
												}

											$.ajax({
												url: "/Material/Index",
												type: "POST",
												data: {
													"state": 10,
													"num": s.prr_id
												},
												success: function (s2) {
													$("#MZ_MCF tr").remove()
													$("#MZ_MCF2 tr").remove()
													var am = 0;
													var ap = 0;
													var acl = 0;
													$.each(s2, function (i, hc) {
														if (hc.prrw_guige != "辅料") {
                                                            ap += hc.prrw_jia*1
                                                            am += ((hc.prrw_c * hc.prrw_k * hc.prrw_g * hc.prrw_shu) / 1000000000).toFixed(4)*1
															var $tr =
																$(`
								<tr>
												<td></td>
												<td>
																<input type="text" style="width:60px;height:25px" />
												</td>
												<td>
																<select class="MZ_CL" style="width:130px;height:25px" id="MZ_CL">
																	<option value="${hc.prrw_zc}">${hc.prrw_zc}</option>
																	@foreach (var item in ViewBag.parice as List<parice>)
																	{
																		if (item.PA_Shuxing == 1)
																		{
																			<option value="@item.PA_ZhongL">@item.PA_ZhongL</option>
																		}
																	}
																</select>
												</td>
												<td>
																<input type="number" class="MZ_gg" id="mz_c" value="${hc.prrw_c}" style="width:60px;height:25px" />
												</td>
												<td>
																<input type="number" class="MZ_gg" id="mz_k" value="${hc.prrw_k}" style="width:60px;height:25px" />
												</td>
												<td>
																<input type="number" class="MZ_gg" id="mz_g" value="${hc.prrw_g}" style="width:60px;height:25px" />
												</td>
												<td>
																<input type="number" class="MZ_gg" id="mz_sj" value="${hc.prrw_g}" style="width:60px;height:25px" />
												</td>
												<td>
																<input type="number" class="MZ_gg" id="MZ_shuliang" value="${hc.prrw_shu}" name="MZ_SL" style="width:60px;height:25px" />
												</td>
												<td class="MZ_TJ" id="MZ_TJ">${((hc.prrw_c * hc.prrw_k * hc.prrw_g * hc.prrw_shu)/1000000000).toFixed(4)}</td>
												<td id="mz_sh">${hc.prrw_sh}</td>
												<td id="mz_lfj">${hc.prrw_guige}</td>
												<td class="MZ_MCF" id="MZ_MC">${hc.prrw_jia}</td>
												<td>
																<a href="#" id="MZ_CZ">删除</a>
												</td>
								</tr>
				 `);
															$("#MZ_MCF").append($tr)

														}
														else {
															acl += hc.prrw_jia*1
															var ddd = hc.prrw_zc.split("+")
															var $tr2 = $(`
															<tr>
																<td></td>
																<td>
																	<select style="width:130px;height:25px" id="MZ_FL">
																		<option value="${hc.prrw_zc}">${ddd[1]}</option>
																		@foreach (var item in ViewBag.parice as List<parice>)
																		{
																			if (item.PA_Shuxing == 6)
																			{
																				<option value="@item.PA_T+@item.PA_ZhongL">@item.PA_ZhongL</option>
																			}

																		}
																	</select>
																</td>
																<td><input type="number" value="${hc.prrw_shu}" style="width:60px;height:25px" id="MZ_FLSL"/></td>
																<td>${ddd[0]}</td>
																<td class="MZ_FLF" id="MZ_FLF">${hc.prrw_jia}</td>
																<td><a href="#" id="MZ_FLH">删除</a></td>
															</tr>
																	 `);
                                                            $("#MZ_MCF2").append($tr2)
														}

													})
													var $tr = $(`
								<tr>
									<td></td>
									<td>
										<input type="text" style="width:60px;height:25px" />
									</td>
									<td>
										<select class="MZ_CL" style="width:130px;height:25px" id="MZ_CL">
											<option value="0">@Resource.String1144</option>
											@foreach (var item in ViewBag.parice as List<parice>)
											{
												if (item.PA_Shuxing == 1)
												{
													<option value="@item.PA_ZhongL">@item.PA_ZhongL</option>
												}
											}
										</select>
									</td>
									<td>
										<input type="number" class="MZ_gg" id="mz_c" style="width:60px;height:25px" />
									</td>
									<td>
										<input type="number" class="MZ_gg" id="mz_k" style="width:60px;height:25px" />
									</td>
									<td>
										<input type="number" class="MZ_gg" id="mz_g" style="width:60px;height:25px" />
									</td>
									<td>
										<input type="number" class="MZ_gg" id="mz_sj" style="width:60px;height:25px" />
									</td>
									<td>
										<input type="number" class="MZ_gg" id="MZ_shuliang" name="MZ_SL" style="width:60px;height:25px" />
									</td>
									<td class="MZ_TJ" id="MZ_TJ"></td>
									<td id="mz_sh"></td>
									<td id="mz_lfj"></td>
									<td class="MZ_MCF" id="MZ_MC"></td>
									<td>
										<a href="#" id="MZ_CZ">@Resource.String1063</a>
									</td>
								</tr>
							 `);
													$("#MZ_MCF").append($tr)
													var $tr = $(`
					<tr>
						<td></td>
						<td>
							<select style="width:130px;height:25px" id="MZ_FL">
								<option value="djdd">@Resource.String1144</option>
								@foreach (var item in ViewBag.parice as List<parice>)
								{
									if (item.PA_Shuxing == 6)
									{
										<option value="@item.PA_T+@item.PA_ZhongL">@item.PA_ZhongL</option>
									}

								}
							</select>
						</td>
						<td><input type="number" style="width:60px;height:25px" id="MZ_FLSL"/></td>
						<td></td>
						<td class="MZ_FLF" id="MZ_FLF"></td>
						<td><a href="#" id="MZ_FLH">@Resource.String1063</a></td>
					</tr>
							 `);
													$("#MZ_MCF2").append($tr)
													$("#ALL_MCTJ").text(am)
													$("#ALL_MCF").text(ap)
													$("#ALL_FLF").text(acl)

												},
												error: function (s) {
													alert("系统错误!");
												}
											})
											          $.ajax({
                                                        url: "/Material/Index",
                                                        type: "POST",
                                                        data: {
                                                            "state": 13,
                                                            "num": s.prr_id
                                                        },
														success: function (s2) {
															$("#gyfffjd tr").remove()
															var ddfj = 0;
															$.each(s2, function (i, ol) {
                                                                ddfj += ol.pfw_jia*1
                                                                if (ol.CL_beizhu =="其他工艺") {
																															var $tr = $(`
			<tr>
							<td><input type="text" id="MZ_gymc" style="width:100px;height:25px" placeholder=""  value="${ol.pfw_zc}"/></td>
							<td><input type="number" class="MZ_jgf" style="width:100px;height:25px"placeholder="" value="${ol.pfw_jia}"/></td>
							<td><a href="#" id="MZ_JGFH">删除</a></td>
			</tr>
`);
                                   $("#gyfffjd").append($tr)
																}
																else {
																	$("#MZ_RG").val(ol.pfw_zc)
																	$("#MZ_RGF").text(ol.pfw_jia)
                                                                    $("#ALL_jgf").text(ddfj)
																}

															})
																													var $tr = $(`
			<tr>
							<td><input type="text" id="MZ_gymc" style="width:100px;height:25px" placeholder="@Resource.String1211" /></td>
							<td><input type="number" class="MZ_jgf" style="width:100px;height:25px"placeholder="@Resource.String1148"/></td>
							<td><a href="#" id="MZ_JGFH">@Resource.String1063</a></td>
			</tr>
`);
                                                            $("#gyfffjd").append($tr)
                                                        },
                                                        error: function (s) {
                                                            alert("系统错误!");
                                                        }
                                                    })

											}
                                        },
                                        error: function (s) {
                                            alert("系统错误!");
                                        }
                                    })
								}
							}
                        }
                        else {
                            alert(e)
                        }
                    },
                    error: function () {
                        alert("系统错误");
                    }
                })

                $.ajax({
                    url: '/Material/Index',
                    type: 'POST',
                    data: {
                        "BOM2_liao": WLLH,
                        "state": 2
                    },
                    success: function (e) {
						$.each(e, function (i, item) {
                            $(".MIaoshud").children().eq(1).text(item.FM_ms)
							$(".MIaoshud").children().eq(3).text(item.FM_ycl)
                            $(".MIaoshud_C").children().eq(1).text(item.FM_ms)
                            $(".MIaoshud_C").children().eq(3).text(item.FM_ycl)
                        })
                    },
                    error: function () {
                        alert("系统错误");
                    }
				})

                var yijishi = $(e.target).parent().parent().children().eq(10).text() //物料名
				var jisn = yijishi == "1" ? "纸制品" : yijishi == "2" ? "木制品" : yijishi == "3" ? "塑料" : ""
                var erji = $(e.target).parent().parent().children().eq(10).text() //物料名

				$("#wulm").text(WLname)
				$("#WLaoed").text(WLliao)
				$("#liaoh").text(WLLH)
				$("#flelei").text(wiliaohsjdsd)
				$("#fellei2").text(erji)
				$("#NAmeok,#NAmeoked").text($("#hsijddd").text()) //项目名称
				$("#BUJian,#BUJianed").text(WLname) //物料名称
                var sjing = $(e.target).parent().parent().children().eq(7).text()
				$("#nianshun").text(sjing)
                $(".ksmwww").text($(e.target).parent().parent().children().eq(6).text())
				$(".leibieshu").children().eq(1).text(jisn)
				$(".leibhu").children().eq(1).text(jisn)
				$(".leibieshu").children().eq(3).text(erji)
				$(".leibhu").children().eq(3).text(erji)
                /*判断是否保存记录 判断*/
				jidns(guige)
				//判断启用
				var shune = $(e.target).parent().prev().text()
                if (shune == "泡沫（裁切/粘合）" || shune =="泡沫（模具成型）") {
                    shune="缓冲材"
				}
                if (shune == "防静电袋（膜/袋）" || shune == "屏蔽袋（膜/袋）" || shune == "VCI袋子（膜/袋）" || shune == "膜/袋") {
                    shune = "塑料袋"
				}
                if (shune == "铝箔袋（膜/袋）") {
                    shune = "铝箔"
                }
				if (wiliaohsjdsd == "3") {
					var selectji = document.getElementById("SL_WLFL")
					for (var i = 0; i < selectji.options.length; i++) {
						if (selectji.options[i].text == shune) {
							selectji.options[i].selected = true;
                            spec() //格局物料类型显示规格计算
                            AuxiliaryPanel() //根据物料类型来显示辅料】
                            ObtainProcessingFee()
							BlisterProcessFlow()
							PrintingMaterialsCost(bomind)
                            PlasticBagClassification()
						}
					}
                    /*$("#SL_WLFL").val(shune)*/
				}
				/*判断是否保存记录 判断*/

			})
			//点击彩印确定按钮  获取选中的工艺名
			$("#CY_Quebec").click(function () {
				if ($("#shugndwsq").text() == "") {
					alert("当前成本为空， 请选择合适的阶梯！")
					return
                }
				var CCCC = $('#CY_ZKC').val()
				var KKKK = $('#CY_ZKK').val()
				var GUI = CCCC + "*" + KKKK;
				//存物料信息   存物料返回id的值
				var ProcessRecord = {
					wl_name: $("#BUJianed").text(),
                    wl_liao: Intid,
					wl_fen: 1,
					wu_fenLei: "彩印纸箱",
					wl_leng: $("#ZB_msed option:selected").val(),
					wl_xing: $("#Lei_xined option:selected").val(),
					wl_gui: GUI,
					wl_c: $('input[name="CYJK"]').val(),
                    wl_k: $('input[name="CYJK1"]').val(),
                    wl_g: $('input[name="CYJK2"]').val()
				}
				var PRRid = 0
				var panduan = 0
				$.ajax({
					url: '/Material/AddProcessRecord',
					type: 'POST',
					data: ProcessRecord,
					success: function(data) {
						console.log(data)
						if (data != null || data != "") {
							PRRid = data
							panduan = 1
						}
						//存材料
						var CraftMaterials = []
                        $(".ZB_KZed").each(function(KML, LP) {
							var komfn = $(LP).val()
							if (komfn != "") {
                                var LLM = komfn == null ? "0" : komfn.split("+")
                                var id = LLM[LLM.length - 2]
                                CraftMaterials.push({
                                    cl_id: id,
                                    prrw_jia: $(LP).parent().next().next().text(),
                                    prrw_guige: $("#minlps").text(),
                                    prrw_shu: 1,
                                    prr_id: PRRid
                                })
                            }
						})

						console.log(CraftMaterials)

						$.ajax({
							url: "/Material/addCraftMaterials",
							type: "POST",
							data: JSON.stringify(CraftMaterials),
							contentType: "application/json;charset=utf-8",
							dataType: "json",
							success: function(text) {
								console.log(text)
								//存储工艺数据
								var ProcessFlow = []
                                $(".YS_GFESHI").each(function(KML, LP) {
									if ($(LP).val() != "") {
										var names = $(LP).parent().parent().children().eq(0).text()
                                        var guige = $("#CY_xian").children().children().eq(8).text()
										var GOao = $('input[name="S_num3"]').val()
										var KUnag = $('input[name="S_num2"]').val()
                                        var baozhuag = names;
                                        var SHijdn = $(LP).parent().parent().children().eq(5).children().text()
										if (names == "@Resource.String1109") {
											SHijdn = $(LP).parent().parent().children().eq(4).children().val() + "色 :" + $(LP).parent().parent().children().eq(5).children().text()
										} else if (names == "@Resource.String1056") {
											guige = ((GOao * 1 + KUnag * 1) / 1000).toFixed(4)
                                        }
										ProcessFlow.push({
											gy_id: $(LP).val().split("+")[$(LP).val().split("+").length - 1],
                                            pfw_jia: SHijdn,
											prr_id: PRRid,
                                            pfw_gg: guige,
											CL_beizhu: baozhuag,
											pfw_Zhengfan: $(LP).parent().parent().children().eq(1).children().val()
										})
									}
								})
								//双面胶
                                $(".CYSFL").each(function(KML, LP) {
									if ($(LP).val() != "") {
										ProcessFlow.push({
											gy_id: $(LP).val().split("+")[$(LP).val().split("+").length - 1],
											pfw_jia: $(LP).parent().parent().children().eq(4).text(),
											prr_id: PRRid,
											pfw_gg: $(LP).parent().parent().children().eq(3).children().val(),
											CL_beizhu: $("option:checked", LP).text(),
                                            pfw_zc: $("#shufn_s").val(),
										})
									}
								})
								//辅料
								$(".CYFZL").each(function () {
									if ($(this).parent().next().children().val() != "") {
										ProcessFlow.push({
											pfw_jia: $(this).parent().parent().children().eq(1).children().val(),
											prr_id: PRRid,
											pfw_gg: $(this).parent().parent().children().eq(2).children().val(),
											CL_beizhu: $("option:checked", this).text()
                                        })
                                    }
								})
								//包装
                                $("#CY_baoz").each(function () {
                                    if ($(this).val() != "") {
                                        ProcessFlow.push({
                                            pfw_jia: $(this).val(),
                                            prr_id: PRRid,
											pfw_gg: "",
                                            CL_beizhu: $("option:checked", this).text()
                                        })
                                    }
                                })
								$.ajax({
									url: "/Material/addProcessFlow",
									type: "POST",
									data: JSON.stringify(ProcessFlow),
									contentType: "application/json;charset=utf-8",
									dataType: "json",
									success: function(text) {
										console.log(text)
									},
									error: function(text) {
										alert("系统错误" + text);
									}
								})
							},
							error: function(text) {
								alert("系统错误" + text);
							}
						})
					},
					error: function() {
						alert('Request Error');
					}
				})
				var jieti = ""
				$(".Jinhsu").each(function(i, sjk) {
					var sji = $(sjk).parent().parent().children().eq(6).children().text();//价格
					var sjied = $(sjk).parent().parent().children().eq(2).children().val()//实际阶梯
					jieti += sji + ":" + sjied + ";" //阶梯价：阶梯
				})
				console.log(jieti)
				var OPtas = {
					OP_jiehe: jieti, //保存对应的数值
					OP_price: $("#shugndwsq").text(),//dui
					OP_YUN: 0,
					OP_CAi: $("#Zjgkgond").text(),
					OP_JIA: $("#CYst").text(),
					OP_GUAN: 0,
					OP_LR: 0
				}
				$.ajax({
					url: "/Material/APPoptiosjn",
					type: "POST",
					data: {
						"OPtas": OPtas,
						"BOM2_id": Intid,
						"stannd": 1
					},
					success: function(s) {
						alert(s);
						$("#DyangSE").css("display", "none");
						window.location.reload(true)
					},
					error: function(s) {
						alert("系统错误!");
					}
				})
			})
			//水印数据
			$("#Quebec").click(function() {
                var CCCC = $('input[name="Z_Cs"]').val()
                var KKKK = $('input[name="Z_Ks"]').val()
				var GUI = CCCC + "*" + KKKK;
				//存物料信息   存物料返回id的值
				var ProcessRecord = {
					wl_name: $("#BUJian").text(),
                    wl_liao: Intid,
					wl_fen: 1,
					wu_fenLei: "水印纸箱",
					wl_leng: $("#ZB_ms option:selected").val(),
					wl_xing: $("#Lei_xin option:selected").val(),
					wl_gui: GUI,
                    wl_c: $('input[name="SHUNHH"]').val(),
                    wl_k: $('input[name="SHUNHKK"]').val(),
                    wl_g: $('input[name="SHH"]').val()
				}
				var PRRid = 0
				var panduan = 0
				console.log(ProcessRecord)
				$.ajax({
					url: '/Material/AddProcessRecord',
					type: 'POST',
					data: ProcessRecord,
					success: function(data) {
						console.log(data)
						if (data != null || data != "") {
							PRRid = data
							panduan = 1
						}
						//存材料
						var CraftMaterials = []
						$(".ZB_KZ").each(function (KML, LP) {
							if ($(LP).val()!="") {
                                var komfn = $(LP).val()
                                var LLM = komfn == null ? "0" : komfn.split("+")
                                var id = LLM[LLM.length - 2]
                                CraftMaterials.push({
                                    cl_id: id,
                                    prrw_jia: $(LP).parent().next().next().text(),
                                    prrw_guige: $("#minlps").text(),
                                    prrw_shu: 1,
                                    prr_id: PRRid
                                })
                            }
						})

						console.log(CraftMaterials)
						$.ajax({
							url: "/Material/addCraftMaterials",
							type: "POST",
							data: JSON.stringify(CraftMaterials),
							contentType: "application/json;charset=utf-8",
							dataType: "json",
							success: function(text) {
								console.log(text)
								//存储工艺数据
								var ProcessFlow = []

								$(".GONY").each(function (KML, LP) {
									if ($(LP).val()!="") {
										var names = $(LP).parent().parent().children().eq(0).text()
										var guige = 0
										var sjinf = $(LP).val().split("+")[0];
										var GOao = $('input[name="S_num3"]').val()
										var KUnag = $('input[name="S_num2"]').val()
										var baozhuag = ""
										if (names == "@Resource.String1056") {
											guige = (sjinf * (GOao * 1 + KUnag * 1) / 1000).toFixed(4)
										} else if (names == "@Resource.String1054") {
											guige = $(".jisnas").val()
											sjinf = $(".jisna").val()
										} else {
											guige = $("#minlps").text()
										}
										ProcessFlow.push({
											gy_id: $(LP).val().split("+")[$(LP).val().split("+").length - 1],
											pfw_jia: sjinf,
											prr_id: PRRid,
											pfw_gg: guige,
                                            CL_beizhu: names
										})
                                    }
								})
								$(".CYFL").each(function (KML, LP) {
									if ($(LP).val()!="") {
                                        var baozhuag = ""
                                        ProcessFlow.push({
                                            gy_id: $(LP).val().split("+")[$(LP).val().split("+").length - 1],
                                            pfw_jia: $(LP).val().split("+")[$(LP).val().split("+").length - 1],
                                            prr_id: PRRid,
                                            pfw_gg: $("#shufn_sed").val(),
                                            CL_beizhu: $("option:checked", LP).text(),
                                            pfw_zc: $("#shufn_sed").val(),
                                        })
                                    }
								})
								console.log(ProcessFlow)

								$.ajax({
									url: "/Material/addProcessFlow",
									type: "POST",
									data: JSON.stringify(ProcessFlow),
									contentType: "application/json;charset=utf-8",
									dataType: "json",
									success: function(text) {
										console.log(text)
									},
									error: function(text) {
										alert("系统错误" + text);
									}
								})
							},
							error: function(text) {
								alert("系统错误" + text);
							}
						})
					},
					error: function() {
						alert('Request Error');
					}
				})
				var OPtas = {
					OP_shu: $("#YunFBz").val(),
					OP_price: $("#zjoaqpll").text(),
					OP_YUN: $("#Yuhn_s").text(),
					OP_CAi: $("#kojjik").text(),
					OP_JIA: $("#Zongjis").text(),
					OP_GUAN: $("#Giuanlifei").text(),
					OP_LR: $(".Guani_sjisn").text()
				}
				console.log(OPtas)
				$.ajax({
					url: "/Material/APPoptiosjn",
					type: "POST",
					data: {
						"OPtas": OPtas,
						"BOM2_id": Intid,
						"stannd": 1
					},
					success: function(s) {
						alert(s);
						$("#DyangSE").css("display", "none");
                        window.location.reload(true)
					},
					error: function(s) {
						alert("系统错误!");
					}
				})
			})
		})
		//查找功能
		$(function () {
			$(document).on("click", ".quxiao", function () {
                $("#addwl_main").css({ "display": "none" })
			})

            $(document).on("click", "#wlxxxxxx", function (e) {

				var liao = $(e.target).parent().parent().children().eq(5).text()
                $.ajax({
                    url: '/Material/Index',
                    type: 'POST',
                    data: {
                        "BOM2_liao": liao,
                        "state": 2
                    },
                    success: function (e) {
						$("#addwl_main").css({ "display": "block" })
						$.each(e, function (i, item) {
							$("#LevenED").val()//层级
                            $("#amt_WLM").val(item.FM_name)
                            $("#amt_WLBM").val(item.FM_bai)
                            $("#cahns").val(item.FM_long)
                            $("#cahns1").val(item.FM_kuan)
                            $("#cahns2").val(item.FM_gao)
                            $("#amt_BMCL").val(item.FM_bmcl)
                            $("#amt_YCL").val(item.FM_ycl)
                            $("#amt_MS").val(item.FM_ms)
                            $("#amt_NYL").val(item.FM_nyl)
                            $("#amt_DW").val(item.FM_ji)
							$("#shuxinss").val(item.FM_Zhuang)
                            $("input[name='Biaomian']").val(item.FM_Jieti)
                            $("#leibei_d").val(item.FM_yj)
                            $("#leibei_x").val(item.FM_ej)
						})
                    },
                    error: function () {
                        alert("系统错误");
                    }
                })
			})
			getGYB()
			$("#BomS").click(function() {
				getGYB()
			})

			function getGYB() {
				var liao = $("#liao").val();
				var wu = $("#shu").val();
				var hu = $("#shenDan").text();
				$.ajax({
					url: '/Material/Index',
					type: 'POST',
					data: {
						"BOM2_wuLiu": wu,
						"BOM2_liao": liao,
						"names": hu,
						"state": 1
					},
					success: function(e) {
						createRow(e);
					},
					error: function() {
						alert("系统错误");
					}
				})
			}

			function createRow(x) {
                var bid = $("#bid").text()
                var fro = $("#for").text()
				$.each(x, function (i, item) {
					var shjjd = "@Resource.String1009";
                    if (item.BOM2_ST == "彩印纸箱" || item.BOM2_ST == "水印瓦楞箱" || item.BOM2_ST == "水印拉链箱" || item.BOM2_ST == "缓冲材" || item.BOM2_ST == "葫芦膜" || item.BOM2_ST == "气泡袋" || item.BOM2_ST == "气泡枕" || item.BOM2_ST == "缠绕膜" || item.BOM2_ST == "塑料袋" || item.BOM2_ST == "木箱" || item.BOM2_ST == "木托盘" || item.BOM2_ST == "胶带" || item.BOM2_ST == "吸塑" || item.BOM2_ST == "泡沫（裁切/粘合）" || item.BOM2_ST == "防静电袋（膜/袋）" || item.BOM2_ST == "铝箔袋（膜/袋）" || item.BOM2_ST == "屏蔽袋（膜/袋）" || item.BOM2_ST == "VCI袋子（膜/袋）" || item.BOM2_ST == "膜/袋") {

					} else {
						shjjd = "";
					}
					var $tr =
						$(`<tr style="text-align-last:center;">
								   <td style="width:50px;"></td>
								   <td id="CG_INFSQD" style="display:none">${item.BOM2_id}</td>
								   <td><a href="#" id="wlxxxxxx">物料信息</a></td>
								   <td id="chen"> ${item.BOM2_chen}</td>
								   <td id="duan">${item.BOM2_duan}</td>
								   <td id="liao">${item.BOM2_liao}</td>
								   <td id="wuliao" style="width:300px;">${item.BOM2_wuLiu}</td>
								   <td>${item.BOM2_Nian}</td>
								   <td>${item.BOM2_Yong}</td>
								   <td>
									   <input type="checkbox" name="Jingoyng" value="禁用" />
								   </td>
								   <td style="display:none">${item.BOM2_Sone}</td>
								   <td id="DanJe_sel">${item.BOM2_ST}</td>
								   <td style="color:darkblue;"><span id="DanJe" class="YinsC">${shjjd}</span></td>
								   <td style="display:none">${item.BOM2_BQing}</td>
								   <td style="display:none">${item.BOM2_Guige}</td>
								   <td id="liliojsg">${item.BOM2_mioa}</td>
								   <td style="width:50px;"><input type="radio" name="shu" value="1" class="RADWL"/></td>
								   <td style="width:50px;"><input type="checkbox" class="CHedf"/></td>
							   </tr>
						`);
                    $("#BoTa").append($tr)
				})
				var len = $("#BoTa tr").length;
				for (var i = 0; i < len; i++) {
					console.log(1)
					$("#BoTa tr:eq(" + i + ") td:nth-child(1)").text(i + 1);
				}
                var bid = $("#bid").text()
				var fro = $("#for").text()
				if (fro != "" && fro != null) {
					$("#BoTa tr").each(function (i, iu) {
						var bom = $("td[id=CG_INFSQD]", iu).text()
						if (bom == bid) {
							$("span[id=DanJe]", iu).trigger('click')
							console.log("触发事件")
						}
					})
					$(".quxshudq").css({ "display": "none" })
                    $(".YinsC").css({ "display": "none" })
					$("#CHAKAN").css({ "display": "none" })
					$("#Quebecs").css({ "display": "none" })
					$("#ERjl").css({ "display": "none" })
					$("#log_back").css({ "display": "none" })
					$("#FanhuiJK").css({ "display": "none" })
					$("#li11").css({ "color": "black", "background-color": "white" })
				}
				else {
                    /*$("#li4").css({ "color": "black", "background-color": "white" })*/
				}
			}
			//后台提交
			$(document).on("click", ".RADWL", function () {
                $(".CHedf").removeAttr("disabled");
				$(this).parent().next().children().attr("disabled", "disabled")
			})

            $(document).on("click", "#TONGB", function () {
				if (confirm("是否已单选列更新多选列的工艺！")) {
					var WLBMsj=[]
                    //取单选行的值
					var TONGJi = 0;
                    $("input:radio[class=RADWL]:checked").parent().parent().each(function (i, item) {
                        var shun = "1"
                        WLBMsj.push({
                            BOM2_id: $("#CG_INFSQD", item).text(),
                            BOM2_wuLiu: $("#wuliao ", item).text(),//物料信息
                            BOM2_liao: $("#liao", item).text(),//料号
                            BOM2_Guige: shun
						})
						TONGJi += 1;
					})
					if (TONGJi > 0) {
						//取多选行的值
						var J = 0;
						$(".CHedf:checked").parent().parent().each(function (i, item) {
							var shun = "2"
							WLBMsj.push({
								BOM2_id: $("#CG_INFSQD", item).text(),
								BOM2_wuLiu: $("#wuliao ", item).text(),//物料信息
								BOM2_liao: $("#liao", item).text(),//料号
								BOM2_Guige: shun
							})
							J+=1;
						})
						console.log(WLBMsj)
                        if (J > 0) {
							//产地到后台
							$.ajax({
								url: '/Procure/dle',
								type: 'POST',
								data: JSON.stringify(WLBMsj),
								contentType: "application/json;charset=utf-8",
								dataType: "json",
								success: function (Aed) {
									$.ajax({
										url: '/Procure/copy',
										type: 'POST',
										data: JSON.stringify(WLBMsj),
										contentType: "application/json;charset=utf-8",
										dataType: "json",
										success: function (Aed) {
											alert(Aed)
											window.location.reload(true);
										},
										error: function () {
											alert("系统错误");
										}
									})
								},
								error: function () {
									alert("系统错误");
								}
							})
						} else {
                            alert("请选择子列；")
						}

					} else {
						alert("请选择母列；")
					}
                }
			})
		})

		$(document).on("click", ".quxshudt", function () {
            var bid = $("#bid").text()
			var fro = $("#for").text()
			var bian = $("#shenDan").text()
			if (fro == "HJSP") {
                window.location.href = "/ShenPI/HJSP?bians=" + bian + "&&Njism=核价审批";
			}
			if (fro == "HJJM") {
                window.location.href = "/Procure/pricing_New?APP_bian=" + bian;
            }
		})
		//水印纸箱计算
		$(function() {
			Find_Tear_and_ProcessingCharges()
            $(document).on("click", "#DanJe", function (e) {
                setTimeout(function () {
                    var wiliaoerji = $(e.target).parent().parent().children().eq(11).text() // 二级分类
                    console.log(wiliaoerji)
                    if (wiliaoerji == "水印瓦楞箱" || wiliaoerji == "水印拉链箱") {
                        zhsun_K_sji()
                    }
                }, 1500);
            })
            //执行
            function zhsun_K_sji() {
                var Intid = $("#bomindy").text()
                $.ajax({
                    url: '/Material/GongYiHuiFU',
                    type: 'POST',
                    data: { "Bomid": Intid, "state": 1 },
                    success: function (e) {
                        if (e.length > 0) {
							$.each(e, function (i, item) {
                                var SYLX = item.wl_leng == "" ? "1" : item.wl_leng
                                var SYFEL = item.wl_xing == "" ? "1" : item.wl_xing
                                $("#ZB_ms").val(SYLX)
                                $("#Lei_xin").val(SYFEL)
                                $("#Lei_xin").trigger('change')
                                if (item.wl_xing == 8 || item.wl_xing == 9) {
                                    console.log(item.wl_gui.split('*'))
                                    var GUISWDE = item.wl_gui.split('*')
                                    $("input[name='Z_Cs']").val(GUISWDE[0])
									$("input[name='Z_Ks']").val(GUISWDE[1])
									$("input[name='Z_Ks']").trigger('keyup')
                                }
                            })
                            //返回物料
                            $.ajax({
                                url: '/Material/GongYiHuiFU',
                                type: 'POST',
                                data: { "Bomid": Intid, "state": 2 },
								success: function (Aed) {
                                    console.log(Aed)
                                    var Thuanzhi = 0
                                    $(".ZB_CS").each(function (shu, L) {
                                        $(L).val(Aed[Thuanzhi].PA_LengBie)
                                        $('.ZB_CS').trigger('change');
                                        var ahh = Aed[Thuanzhi].PA_T + "+" + Aed[Thuanzhi].PA_ID + "+" + Aed[Thuanzhi].PA_KZ
                                        console.log(ahh)
                                        $(L).parent().parent().children().eq(2).children().val(ahh)
                                        Thuanzhi++
                                    })
                                    $('.ZB_KZ').trigger('change');
                                },
                                error: function () {
                                    alert("系统错误");
                                }
							})
							//返回工艺
                            $.ajax({
                                url: '/Material/GongYiHuiFU',
                                type: 'POST',
                                data: { "Bomid": Intid, "state": 3 },
								success: function (Aed) {
                                    console.log(Aed)
                                    var Biaomian = [];
                                    var caiying = [];
                                    $.each(Aed, function (i, item) {
                                        if (item.BeiZ == "印刷颜色：") {
                                            Biaomian.push({
                                                name: item.JiaoG,
                                                mian: item.ZF
                                            })
                                        }
                                        if (item.BeiZ == "表面处理") {
                                            caiying.push({
                                                name: item.JiaoG,
                                                mian: item.ZF,
                                                SE: item.jiage
                                            })
										}
                                        //填充单个的工艺
                                        $(".GONY").each(function (i, LP) {
                                            var T = $(LP).parent().parent().children().eq(0).text()//行的第一个
                                            if (item.BeiZ == T && item.BeiZ != "表面处理" && item.BeiZ != "裱楞" && item.BeiZ != "印刷颜色：") {
                                                $(LP).parent().parent().children().eq(2).children().val(item.JiaoG)
                                                $(LP).trigger("change")
                                            }
                                        })
                                        $(".CYFL").each(function (i, FL) {
                                            var shund = $(FL).find('option:eq(1)').text();
                                            if (item.BeiZ == "双面胶" && shund == "双面胶") {
                                                $("#shufn_sed").val(item.ZC)
                                                $(FL).find('option:eq(1)').attr('selected', 'selected');
                                                $(FL).trigger("change")
                                            }
                                            if (item.BeiZ == "撕拉条" && shund == "撕拉条") {
                                                $("#shufn_sed").val(item.ZC)
                                                $(FL).find('option:eq(1)').attr('selected', 'selected');
                                                $(FL).trigger("change")
                                            }
                                        })
									})
                                    //遍历集合
									Biaomian.forEach(function (HUJ, BM) {
                                        var shufn = Biaomian.length
                                        if (shufn > 1) {
                                            for (var i = 0; i < shufn - 1; i++) {
                                                $(".sjinfKKM").trigger("click")
                                            }
                                        }
                                        $(".sjinfKKM").each(function (i, KL) {
                                            $(KL).parent().children().eq(1).children().val(HUJ.mian)
                                            $(KL).parent().children().eq(2).children().val(HUJ.name)
                                            $(KL).parent().children().eq(2).children().trigger("change")
                                        })
                                    });
									caiying.forEach(function (HUJ, BM) {
                                        console.log(HUJ.name, 3, BM)
                                        var shufn = caiying.length
                                        if (shufn > 1) {
                                            for (var i = 0; i < shufn - 1; i++) {
                                                $(".LPMMJ").trigger("click")
                                            }
                                        }
                                        $(".LPMMJ").each(function (i, KL) {
                                            $(KL).parent().children().eq(1).children().val(HUJ.mian)
                                            $(KL).parent().children().eq(2).children().val(HUJ.name)
                                            $(KL).parent().children().eq(2).children().trigger("change")
                                        })
                                    });
                                },
                                error: function () {
                                    alert("系统错误");
                                }
                            })
                            Zjkons()
						}
                    },
                    error: function () {
                        alert("系统错误");
                    }
                })
            }
			//显示单瓦楞和双瓦楞
			function WL() {
				var ds = $("#ZB_ms").val()
				var ds2 = ds.length
				console.log(ds2)
				var $tfoot = $(`<tr>
										<td>@Resource.String1028</td>
										<td>
											<select class="ZB_CS" style="width:120px;">
												<option>—@Resource.String72—</option>
											   @foreach (var item in ViewBag.ListPP as List<parice>)
												{
													if (@item.PA_Shuxing == 5 && @item.PA_LengBie.Contains("瓦"))
													{
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
											</select>
										</td>
										<td>
											<select class="ZB_KZ" style="width:300px;">
											</select>
										</td>
										<td></td>
										<td class="ZB_Unit_price"></td>
									</tr>
									<tr>
										<td>@Resource.String1029</td>
										<td>
											<select class="ZB_CS" style="width:120px;">
												<option>—@Resource.String72—</option>
											   @foreach (var item in ViewBag.ListPP as List<parice>)
												{
													if (@item.PA_Shuxing == 5)
													{
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
											</select>
										</td>
										<td>
											<select class="ZB_KZ"style="width:300px;">
											</select>
										</td>
										<td></td>
										<td class="ZB_Unit_price"></td>
									</tr>`)
				var $tbody = $(`
							<tr class="Shuangwa" id="Shuangwa1">
								<td>@Resource.String1028</td>
								<td>
									<select class="ZB_CS" style="width:120px;">
										<option>—@Resource.String72—</option>
									   @foreach (var item in ViewBag.ListPP as List<parice>)
									   {
										   if (@item.PA_Shuxing == 5 && @item.PA_LengBie.Contains("瓦"))
										   {
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
									</select>
								</td>
								<td>
									<select class="ZB_KZ"style="width:3000px;">
									</select>
								</td>
								<td></td>
								<td class="ZB_Unit_price"></td>
							</tr>

							<tr class="Shuangwa"  id="Shuangwa2" >
								<td>@Resource.String1202</td>
								<td>
									<select class="ZB_CS" style="width:120px;">
										<option>—@Resource.String72—</option>
										@foreach (var item in ViewBag.ListPP as List<parice>)
												{
													if (@item.PA_Shuxing == 5)
													{
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
									</select>
								</td>
								<td>
									<select class="ZB_KZ" style="width:300px;">
									</select>
								</td>
								<td></td>
								<td class="ZB_Unit_price"></td>
							</tr>
							`)
				var $tbody2 = $(`
							<tr class="Shuangwa" id="Shuangwa1">
								<td>@Resource.String1028</td>
								<td>
									<select class="ZB_CS" style="width:120px;">
										<option>—@Resource.String72—</option>
									   @foreach (var item in ViewBag.ListPP as List<parice>)
									   {
										   if (@item.PA_Shuxing == 5 && @item.PA_LengBie.Contains("瓦"))
										   {
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
									</select>
								</td>
								<td>
									<select class="ZB_KZ"style="width:3000px;">
									</select>
								</td>
								<td></td>
								<td class="ZB_Unit_price"></td>
							</tr>

							<tr class="Shuangwa"  id="Shuangwa2" >
								<td>@Resource.String1202</td>
								<td>
									<select class="ZB_CS" style="width:120px;">
										<option>—@Resource.String72—</option>
										@foreach (var item in ViewBag.ListPP as List<parice>)
												{
													if (@item.PA_Shuxing == 5)
													{
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
									</select>
								</td>
								<td>
									<select class="ZB_KZ" style="width:300px;">
									</select>
								</td>
								<td></td>
								<td class="ZB_Unit_price"></td>
							</tr>
							`)
				if (ds == "N/A") {
					$("#ZB_ZC_table tbody tr").remove()
					$("#ZB_ZC_table tfoot tr").remove()
				} else {
					if (ds2 == "1") {
						$("#ZB_ZC_table tbody tr").remove()
						$("#ZB_ZC_table tfoot tr").remove()

						$("#ZB_ZC_table tfoot").append($tfoot)
						document.getElementById("kojG").value = 1.30
					} else if (ds2 == "2") {
						$("#ZB_ZC_table tbody tr").remove()
						$("#ZB_ZC_table tfoot tr").remove()

						$("#ZB_ZC_table tbody").append($tbody)
						$("#ZB_ZC_table tfoot").append($tfoot)
						$("#kojG").val("1.25")
					} else if (ds2 == "3") {
						console.log("三层")
						$("#ZB_ZC_table tbody tr").remove()
						$("#ZB_ZC_table tfoot tr").remove()

						$("#ZB_ZC_table tbody").append($tbody)
						$("#ZB_ZC_table tbody").append($tbody2)

						$("#ZB_ZC_table tfoot").append($tfoot)
					}
				}
			}
			//根据描述找到损耗,加工费和厚度
			function Find_Tear_and_ProcessingCharges() {
				var miaoshu = $("#ZB_ms").val()
				$.ajax({
					url: "/Procure/paperboard",
					type: 'GET',
					data: {
						"state": 2,
						"miaoshu": miaoshu
					},
					success: function(data) {
						$.each(data, function(i, item) {
							$("#ZB_jgf").text(item.LB_jia)
							$("#ZB_sh").text(item.LB_shun)
							$("#ZB_HD").text(item.LB_Zlei)
						})
                        shujisuhdu()
					},
					error: function() {
						alert('Request Error');
					}
				})
			}
			//计算模具费用
			function shudn() {
				var nic = $("#Dao_m option:selected").text()
				var sum = 0;
				var nummm = $("#bilish").val()
				var sjif = $("#Dao_m").val()
				console.log(nic)
				if (nic == "印版") {
					$(".nichang").show()
					sum = nummm * sjif / 100
				} else {
					$(".nichang").hide()
					sum = sjif;
				}
				var Z_c = $('input[name="Z_Cs"]').val() * 1
				var Z_K = $('input[name="Z_Ks"]').val() * 1
				var komlpp = (Z_c * Z_K) / 1000000
				$("#Dao_m").parent().next().text(sjif) //标准的价格
				$("#bilish").parent().next().children().text(sum) //标准的价格
				$("#mianjiaMO").text(komlpp.toFixed(4))
				$("#zhongjiseMO,#Mujufai").text((sum * komlpp).toFixed(4))
			}

			$(document).on("click", "#KOKOM", function (e) {
                var ZBC= $('input[name="Z_Cs"]').val() //展开长
				var ZBK = $('input[name="Z_Ks"]').val() //展开宽
                console.log(ZBC, ZBK)
                csjina(ZBC, ZBK)
            })
			//计算水印机床
			function csjina(ZBC, ZBK) {
				var selko = $("#KOKOM").val()
				console.log(selko)
				var sjinfLP = $("#Lei_xin").val()
				var AA = selko.split("*");
				var JCC = AA[0] * 1
				var JCK = AA[1] * 1
				var l1 = Math.floor(JCC / ZBC)
				var l2 = Math.floor(JCK / ZBK)
				$("#KOKOM").parent().next().children().text(JCC)
				$("#KOKOM").parent().next().next().children().text(JCK)

				if (sjinfLP == "2" || sjinfLP == "3") {
					$("#yihchuj").val(1)
					$("#CJIND").text(ZBC * 1 + 20)
					$("#KJIND").text((ZBK * 1 + 20).toFixed(0))
				} else if (sjinfLP == "6") {
					$("#CJIND").text(ZBC)
					$("#KJIND").text((ZBK * 1).toFixed(0))
                    $("#yihchuj").val(1)
					$("#CJIND").parent().parent().hide()
				} else {
                    var he = l1 * l2
					if (selko == "0*0" || he < 1) {
                        $("#KOKOM").val("0*0")
						he = 1
						l1 = 1
						l2=1
					}
					$("#CJIND").text(ZBC * l1 + 20)
					$("#KJIND").text((ZBK * l2 + 20).toFixed(0))
					if (he >= 1) {
						if (l1 >= 1 && l2 >= 1) {
							he = Math.floor(he)
							$("#yihchuj").val(he)
							$("#KOKOM").parent().next().next().next().children().text(he)
						}
					}
				}

			}
			//添加正反面工艺--印刷
			function ZhenFan(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(` <tr>
										<td>@Resource.String1045：</td>
										<td>
											<select>
												<option value="value">@Resource.String1060</option>
												<option value="value">@Resource.String1061</option>
											</select>
										</td>
										<td>
											<select id="Yanse" style="width: 100px;"  class="GONY">
												<option value="">@Resource.String1062</option>
												@foreach (var item in ViewBag.Yinshua as List<libray>)
												{
													if (item.LB_Zlei == "印刷(开槽)")
													{
														<option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
													}
												}
											</select>
										</td>
										<td></td>
										<td>@Resource.String1025/㎡</td>
										<td></td>
										<td class="sjinfKKM"style="color:blue">@Resource.String1063</td>
									</tr>`)
					$("#SHENc thead").append($tr)
					jisnfff()
				} else {
					e.parent().remove()
					jisnfff()
				}
				//添加到表格并改成删除

			}
			//添加正反面工艺--表面
			function Biaomiansji(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(` <tr>
										<td>表面处理</td>
										<td>
											<select>
												 <option value="value">@Resource.String1060</option>
												<option value="value">@Resource.String1061</option>
											</select>
										</td>
										<td>
											<select id="SY_seld" style="width: 100px;"  class="GONY">
												<option value="">@Resource.String1062</option>
												@foreach (var item in ViewBag.Yinshua as List<libray>)
												{
													if (item.ST_ID == 2 && item.LB_fne.Contains("防"))
													{
														<option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
													}
												}
												<option value="jiehe">@Resource.String1057</option>
											</select>
										</td>
										<td></td>
										<td>@Resource.String1025/㎡</td>
										<td></td>
										<td class="LPMMJ" style="color:blue">@Resource.String1063</td>
									</tr>>`)
					$("#SHENc tbody").append($tr)
					jisnfff()
				} else {
					e.parent().remove()
					jisnfff()
				}
			}
			//添加点击事件
			$(document).on("click", ".sjinfKKM", function(e) {
				ZhenFan($(e.target))
			})
			$(document).on("keyup", "", function() {
				shudn()
				Zjkons()
			})
			$(document).on("click", ".LPMMJ", function(e) {
				Biaomiansji($(e.target))
			})

			function GuDing() {
				var sjinfLP = $("#Lei_xin").val()
				if (sjinfLP == "2" || sjinfLP == "3" || sjinfLP == "6") {
					$("#yihchuj").val(1)
				}
			}
			//计算拉链箱jiage
			function lakiqwdr(jsndj, okkslpws) {
				csjina(jsndj, okkslpws)
				GuDing()
				var Z_c = jsndj; //展开长
				var Z_K = okkslpws //展开
				var B = $("#yihchuj").val()
				var CDE = $("#kojnnd").text()
				var CDEd = $(".CY_ts").text()
				var shunf = (Z_c * 1 + 20) * (Z_K * B + 15)
                var sjinfLP = $("#Lei_xin option:selected").val()
                if (sjinfLP == "6") {
                    shunf = (Z_c * Z_K)  //非开模纸版面积
                }
                if (sjinfLP != "6") {
                    shunf = (Z_c * 1 + 20) * (Z_K * B + 15) //非开模纸版面积
                }
				$("#minajisg").text((shunf / 1000000).toFixed(4))
				//$("#kojjik").text((shunf / 1000000 / B * CDE).toFixed(4))
				$("#minlps").text((Z_c * Z_K / 1000000).toFixed(4))
				var temp = 0;
				$(".CY_t").each(function(i, item) {
					temp = temp + $(item).text() * 1
				})
				var klo = $("#kojjik").text()
				$("#weishi").text((temp * 1 + klo * 1 + CDEd * 1).toFixed(4))
				Zjkons()
			}
			//电商版的价格
			function jisnnf(ZJK, ZJKN) {
				csjina(ZJK, ZJK)
				GuDing()
				var Z_c = ZJK
				var Z_K = ZJKN
				var shinf = $("#yihchuj").val() //模数
				var koodk = $("#kojnnd").text() //纸版价
				var sjifn = $("#kojG").val() //系数
				var shunf = 0; //纸版面积
				var sjinfLP = $("#Lei_xin option:selected").val()
				if (sjinfLP == "6") {
                    shunf = (Z_c*Z_K) / 1000000 //非开模纸版面积
				}
                if (sjinfLP != "6") {
					shunf = (Z_c * 1 + 20*1) * ((Z_K * shinf) + 15 * 1) / 1000000 //非开模纸版面积
				}
				var shkdp = shunf * koodk / shinf
				$("#kojjik").text(shkdp.toFixed(3))
				$("#minajisg").text(shunf.toFixed(3))
				$("#minlps").text((shunf / shinf).toFixed(3))
				$("#weishi").text((shkdp * sjifn).toFixed(3))
				Zjkons()
			}
			//通用版
			function jisnnfsdrf(ZC, ZK) {
				var Z_c = ZC
				var Z_K = ZK
				csjina(Z_c, Z_K)
				GuDing()
				var shinf = $("#yihchuj").val() //模数
				var koodk = $("#kojnnd").text() //纸版价
				//$("#CJIND").text(Z_c)
				//  $("#KJIND").text(Z_K * shinf)
				var shunf = (Z_c * Z_K * shinf) / 1000000 //纸版面积
				var shkdp = shunf * koodk / shinf //单个纸版价
				$("#kojjik").text(shkdp.toFixed(3))
				$("#minajisg").text(shunf.toFixed(3))
				$("#minlps").text((shunf / shinf).toFixed(3)) //单个纸版面积
				$("#weishi").text((shkdp * 1).toFixed(3)) //材料价

				Zjkons()
			}
			//获取平方克重
			function Get_SquareGramWeight(e) {
				var pingpai = e.val()
				if (pingpai != null) {
					$.ajax({
						url: "/Procure/paperboard",
						type: 'GET',
						data: {
							"state": 3,
							"pingpai": pingpai
						},
						success: function(data) {
							e.parent().next().children().first().children().remove()
							$.each(data, function(i, item) {
								var $tr = $(`<option value="${item.PA_T}+${item.PA_ID}+${item.PA_KZ}" >${item.PA_KZ}克--${item.PA_ZhongL}-${item.PA_T}@Resource.String1025/吨</option>`);
								e.parent().next().children().first().append($tr);
							})
							var text = $("#SHUAN option:selected").val()
							if (text != null) {
								var parts = text.split("+"); // 使用逗号和空格作为分隔符
								let firstElement = parts[0];
								let lastElement = parts[parts.length - 1];
								$("#CY_xian tr").children().eq(5).children().first().val(firstElement)
								$("#CY_xian tr").children().eq(6).children().first().val(lastElement)
								hdhfjjjd()
								console.log(firstElement, lastElement)
							}
							Product_price_per_ton(e)
							Sum_up()
						},
						error: function() {
							alert('Request Error');
						}
					})
				}
			}
			//获取产品吨价
			function Product_price_per_ton(e) {
				var zbzl = e.parent().parent().children().eq(2).children().val()
				var text = zbzl;
				if (text != null) {
					var parts = text.split("+"); // 使用逗号和空格作为分隔符
					let firstElement = parts[0];
					let lastElement = parts[parts.length - 1];
					e.parent().parent().children().eq(3).text(firstElement)
					e.parent().parent().children().eq(4).text((firstElement * 0.000001 * lastElement).toFixed(4))
				}
			}

            function sjinf() {
                var shidn = $(".kosml").val() * 1//价格
                var Wenb = $(".kosml").find("option:selected").text()//文本
                var miajk = $("#minajisg").text()//面积
                var hisn = $("#yihchuj").val()//
                var shidnsw = $(".kosmled").val() * 1
                var EwFy = 0;//额外的价格
                if (Wenb == "单面印刷") {
                    shidnsw = shidnsw < 1 ? 0 : (shidnsw - 1) * 0.1;
                } else {
                    shidnsw = shidnsw <= 0 ? 0 : shidnsw * 0.2;
                }
                var jisnf = shidn * shidnsw * 0.1 * miajk / hisn//总价
                //var ERFD = EwFy *  miajk / hisn//额外价
                $(".kosml").parent().next().next().children().text(shidn * 0.1)
                $(".kosml").parent().next().next().next().text((jisnf).toFixed(6))
                var sji = $('input[name="Z_Cs"]').val()
                var sjitr = $('input[name="Z_Ks"]').val()
                var Wil = $("#kojjik").text()
                var KOJF = $("#kojG").val()
                var JND = (Wil * 1 * KOJF * 1) + jisnf * 1;
                $("#weishi").text(JND)
                Zjkons()
            }
			//计算纸板组成总价格
			function Sum_up() {
				var temp = 0
				$(".ZB_Unit_price").each(function(i, item) {
					temp = temp + $(item).text() * 1
				})
				var sum = temp * 1 * (1 + $("#ZB_sh").text() * 0.01) + $("#ZB_jgf").text() * 1
				var sumji = temp * 1 * ($("#ZB_sh").text() * 0.01)
				$("#ZB_Total").text(sum.toFixed(4))
				$("#jiahjoks").text(sumji.toFixed(4))
				Zjkons()
			}
			//切换
			$("#Chijisnn").change(function () {
				var JFND = $(this).val()
				var MM = JFND == "1" ? "内径尺寸:" : JFND == "2" ? "制造尺寸:" : JFND == "3" ? "外径尺寸:" : "";
                $("#GUigesed").children().eq(0).text(MM)
                $("#GUigesedse").children().eq(0).text(MM)
			})
			//jish
			function jisnfff() {
				var sihjngrf = 0;
				$("#SHENc tr").each(function(item, obj) {
					var shinf = $("td:nth-child(6)", obj).text()
					sihjngrf += shinf * 1;
				})
				$("#Zongjis").text(sihjngrf.toFixed(4))
				Zjkons()
			}
			//总计--
			///计算方式：通用 ：材料费+工艺费+辅料费+管理费+利润+运费
			///计算方式：拉链 ：成本单价+管理费+利润+运费
			///计算方式：电商 ：材料费*系数+管理费+利润+运费
			function Zjkons() {
				var sjinn = $(".Guani_s").val();
				fuankisj(sjinn)
				var sjinff = $("#Lei_xin").val()
				var sjimmlp2 = $("#Zongjis").text() * 1 //工艺价
				var sjimmlp5 = $("#Giuanlifei").text() * 1 //管理费
				//var sjimmlp6 = $("#LIren").text() * 1 //利润
				//var sjimmlp7 = $("#koqt").val() * 1 //其他费用
				var sjimmlp8 = $("#Yuhn_s").text() * 1 //运输
				var sjimmlp9 = $("#zhongjiseMO").text() * 1 //模具费
				var sjimmlp10 = $("#okkoskse").text() * 1 //辅料
				var sjimmlp14 = $("#kojG").val() * 1 //加工系数
				var sjimmlp11 = $("#weishi").text() * 1 //拉链箱的总价、电商箱的合计价格  通用工艺的材料费
				var jislp = 0;
				if (sjinff == "1" || sjinff == "2" || sjinff == "3" || sjinff == "4") {
					jislp = sjimmlp11 + sjimmlp2 + sjimmlp5 + sjimmlp10 + sjimmlp8;
				}
				if (sjinff == "5") {
					jislp = sjimmlp11;
				}
				if (sjinff == "6") {
					jislp = sjimmlp11;
				}
				if (sjinff == "7") {
                    jislp = sjimmlp11 ;
				}
				if (sjinff == "8") {
                    jislp = sjimmlp11;
				}
                if (sjinff == "9") {
                    jislp = sjimmlp11 + sjimmlp10 + sjimmlp2;
                }
				$("#zjoaqpll").text(jislp.toFixed(4))
			}
			//输入计算
			function shujisuhdu() {
                var leixing = $("#Chijisnn").val()//分类
				var jind = $("#Lei_xin").val()
                var ONER = $('input[name="SHUNHH"]').val()*1//输入长
                var ONER1 = $('input[name="SHUNHKK"]').val()*1//输入宽
                var ONER2 = $('input[name="SHH"]').val()*1//输入高
				var shufn = 0 //长
				var shufn1 = 0 //宽
				var shufn2 = 0//高
				var qwed = $("#ZB_HD").text() * 1
                if (jind=="4") {
					leixing == "1";
                }
                switch (leixing) {
					case "1"://内径尺寸
                        shufn = ONER + qwed//长
						shufn1 = ONER1 + qwed //宽
						switch (jind) {
							case "1": shufn2 = ONER2 + qwed//高
								break;case "2": shufn2 = ONER2 + qwed*2//高
								break;case "3": shufn2 = ONER2 + qwed*3//高
								break;
                            default:
                        }
                        break;
					case "2"://制造尺寸
                        shufn = ONER  //长
                        shufn1 = ONER1  //宽
                        shufn2 = ONER2  //高
                        break;
					case "3"://外径尺寸
                        shufn = ONER - qwed//长
                        shufn1 = ONER1 - qwed //宽
                        switch (jind) {
                            case "1": shufn2 = ONER2 - qwed//高
                                break; case "2": shufn2 = ONER2 - qwed * 2//高
                                break; case "3": shufn2 = ONER2 - qwed * 3//高
                                break;
                            default:
                        }
                        break;
					default:
						break;
				}
                $('input[name="S_num1"]').val(shufn);
                $('input[name="S_num2"]').val(shufn1);
                $('input[name="S_num3"]').val(shufn2);
                var Z_c = 2 * (shufn + shufn1) + 32 * 1; //计算展开长-
				var Z_K = 0;
                ///制造尺寸算法
                switch (jind) {
                    case "1":
                        $(".CY_t,.CY_ts").text("0")
                        Z_K = shufn2 + 0.5 * (shufn1 + qwed - 2 * 1)
                        jisnnfsdrf(Z_c, Z_K)
                        break;
                    case "2":
                        $(".CY_t,.CY_ts").text("0")
                        $("#SHENc tbody").children().eq(4).children().eq(3).text("0")
                        Z_K = shufn2 + shufn1 + qwed - 2 * 1
                        jisnnfsdrf(Z_c, Z_K)
                        break;
                    case "3":
                        $(".CY_t,.CY_ts").text("0")
                        $("#SHENc tbody").children().eq(4).children().eq(3).text("0")
                        Z_K = 2 * shufn1 + shufn2
                        jisnnfsdrf(Z_c, Z_K)
                        break;
                    case "4":
                        $(".CY_t,.CY_ts").text("0")
                        Z_c = shufn1 * 2 + shufn2 * 3 + qwed * 6;
                        Z_K = shufn * 1 + shufn2 * 4 + 18 * qwed;
                        break;
                    case "5":
                        $("#Zongjis,#zhongjiseMO,#okkoskse,#Giuanlifei,#LIren,#koqt,#Yuhn_s,.CY_ts").text("0")
                        var husnfedw = $("#jinded").children().val() * 1 //接舌长度
                        Z_c = (((shufn + shufn1) * 2) - 2) + husnfedw * 1;
                        Z_K = (shufn1 + 0.5) * 2 + shufn2;
                        lakiqwdr(Z_c, Z_K)
                        break;
                    case "6":
                        Z_K = shufn2 + shufn1 + qwed - 2 * 1
                        $(".CY_t,#okkoskse,#zhongjiseMO,#Giuanlifei,#LIren,#koqt,#Yuhn_s").text("0")
                        jisnnf(Z_c, Z_K)
                        break;
                    case "7":
                        Z_K = shufn2 + shufn1 + qwed - 2 * 1;
                        $(".CY_t,#okkoskse,#zhongjiseMO,#Giuanlifei,#LIren,#koqt,#Yuhn_s").text("0")
                        jisnnf(Z_c, Z_K)
                        break;
                    case "8":
                        Z_c = 0;
                        Z_K = 0;
                        $(".CY_t,#okkoskse,#zhongjiseMO,#Giuanlifei,#LIren,#koqt,#Yuhn_s").text("0")
                        jisnnf(Z_c, Z_K)
                        break;
                    case "9":
                        Z_c = 0;
                        Z_K = 0;
                        $(".CY_t,.CY_ts").text("0")
                        jisnnf(Z_c, Z_K)
                        break;
                    default:
                        break;
                }

				var shukolp = Z_c * Z_K * qwed; //计算体积
				var komlpp = Z_c * Z_K; //面积
				$('input[name="Z_Cs"]').val(Z_c.toFixed(1)) //展开长
				$('input[name="Z_Ks"]').val(Z_K.toFixed(1)) //展开宽
				$("#Tijian").text(shukolp.toFixed(4))
                $("#Mianjihdhu").text(komlpp.toFixed(4))
				$("#mianjiaMO").text((komlpp / 1000000).toFixed(4))
				$("#tijishu").text((shukolp / 1000000000).toFixed(4)) //转立方米 用于运费
				console.log((shukolp / 1000000000).toFixed(4))
			}
			//
			function Processing() {
				var shungf = $("#shufn_sed").val() * 1
				var sum = 0
				$(".CY_tingfqs").each(function(i, item) {
                    var jins = $(item).prev().prev().prev().children().text() * 1//单价
					var jinsed = $(item).prev().prev().children().val() * 1//加工费
					var SHUlind = $(item).prev().children().val() * 1//数量
					var slp = 0;
					if (jins > 0) {
                        slp = (shungf * (jins + jinsed)) * SHUlind
						sum += slp
					}
					$(item).text((slp * 1).toFixed(4))
				})
				$("#okkoskse").text(sum.toFixed(4))
				/* hdufh()*/
			}
			//管理费 和利润
			function fuankisj(jdhs) {
				var tihuan = jdhs * 0.01;
				var sjinff = $("#Lei_xin").val()
				var sjimmlp2 = $("#Zongjis").text() * 1 //工艺价
				var sjimmlp11 = $("#weishi").text() * 1 //cailiao
				var sjimmlp10 = $("#okkoskse").text() * 1 //辅料
				var hejiss = 0;
				if (sjinff == "1" || sjinff == "2" || sjinff == "3" || sjinff == "4") {
					hejiss = (sjimmlp2 + sjimmlp10 + sjimmlp11) * tihuan;
				}
				if (sjinff == "5" || sjinff == "6" || sjinff == "7" || sjinff == "8") {
					hejiss = sjimmlp11 * tihuan;
				}
				$("#Giuanlifei").text(hejiss.toFixed(4))
			}
			//装箱方法
			function zuangsin() {
				var $td = $(`<td>@Resource.String1203<input type="number" class="jisna" min="0"/>@Resource.String1025/个</td>`)
				var $td1 = $(`<td>@Resource.String1204<input type="number" class="jisnas" min="0"/>个</td>`)
				$("#SY_bz").parent().next().replaceWith($td)
				$("#SY_bz").parent().next().next().replaceWith($td1)
			}
			//
			function fuisj(jdhsss) {
				var tihuan = jdhsss * 0.01;
				var sjinff = $("#Lei_xin").val()
				var sjimmlp2 = $("#Zongjis").text() * 1 //工艺价
				var sjimmlp11 = $("#weishi").text() * 1 //cailiao
				var sjimmlp10 = $("#okkoskse").text() * 1 //辅料
				var jsinf = $("#Giuanlifei").text() * 1
				var hejiss = 0;
				if (sjinff == "1" || sjinff == "2" || sjinff == "3" || sjinff == "4") {
					hejiss = (sjimmlp2 + sjimmlp10 + sjimmlp11 + jsinf) * tihuan;
				}
				if (sjinff == "5" || sjinff == "6" || sjinff == "7" || sjinff == "8") {
					hejiss = (sjimmlp11 + jsinf) * tihuan;
				}
				$("#LIren").text(hejiss.toFixed(4))
			}

			function sjind() {
				var djinf = $("#Lei_xin option:selected").val()
				var Z_c = $('input[name="Z_Cs"]').val()
				var Z_K = $('input[name="Z_Ks"]').val()
				if (djinf == "1" || djinf == "2" || djinf == "3" || djinf == "4") {
					jisnnfsdrf(Z_c, Z_K)
				}
				if (djinf == "5") {
					lakiqwdr(Z_c, Z_K)
				}
				if (djinf == "6" || djinf == "7" || djinf == "8") {
					jisnnf(Z_c, Z_K)
				}
			}

			function zblxFE() {
				var sjinfSC = ""
				var sjinfds = 0;
				$(".ZB_KZ").each(function(L, OJN) {
					sjinfds++;
					var skMPL = $(OJN).val()
					if (skMPL != null) {
						var LPMKO = skMPL.split("+")
						var KMMM = LPMKO[LPMKO.length - 1].match(/\d+/)
						if ($(".ZB_KZ").length == sjinfds) {
							sjinfSC += KMMM + "%"
						} else {
							sjinfSC += KMMM + "%*"
						}
					}
				})
				return sjinfSC;
			}

			$(document).on("change", ".ZB_KZ", function() {
				var sjinf = zblxFE()
				var jisnd = $("#ZB_ms").val();
				$.ajax({
					url: "/Material/APPoptiosjn",
					type: "POST",
					data: {
						"zbll": jisnd, //纸板楞型
						"ZBLx": sjinf, //纸板类型
						"stannd": 2,
                        "HSJIN": ""
					},
					success: function(s) {
						carkos(s)
					},
					error: function(s) {
						alert("系统错误!");
					}
				})
			})
			//lialak
			function carkos(s) {
				$("#seleect_code option").remove()
				$.each(s, function(re, item) {
					var $TR = $(`<option value="${item[1]}">${item[0]},${item[2]}, ${item[1]}</option>`)
					$("#seleect_code").append($TR)
				})
				$("#seleect_code").parent().next().children().text($("#seleect_code").val())
				$("#kojnnd").text($("#seleect_code").val())
				nLPf()
			}
			$(document).on("change", "#seleect_code", function() {
				$(this).parent().next().children().text($(this).val())
				$("#kojnnd").text($(this).val())
				nLPf()
			})
			//改变种类下拉框触发事件
			$(document).on("change", ".ZB_KZ,.ZB_KZed", function(x) {
				Product_price_per_ton($(x.target))
				sjind()
				Sum_up()
			})

			//改变描述下拉框触发事件--添加楞型的厚度和加工费
			$(document).on("change", "#ZB_ms", function () {
                var TIHU = $(this).val()
                if (TIHU == "B" || TIHU == "A" || TIHU == "C" || TIHU == "E" || TIHU == "EF" || TIHU == "FE") {
                    $("input[name=KKNDS]").val(30)
                } else if (TIHU == "BE" || TIHU == "BC" || TIHU == "BA" || TIHU == "EB" || TIHU == "CB" || TIHU == "AB") {
                    $("input[name=KKNDS]").val(35)
                } else {
                    $("input[name=KKNDS]").val(0)
                }
				WL()
				Find_Tear_and_ProcessingCharges()
				Sum_up()
			})
			//改变厂商触发事件---改版种类
			$(document).on("change", ".ZB_CS", function(e) {
				//循环判断损耗的值
                $(".ZB_CS").each(function (e, sko) {
                    var sjinf = $(sko).val()
                    var LX = $("#ZB_ms").val()
                    var Shunhao = $("#ZB_sh").text()
                    var SUNhao = $("#ZB_jgf").text() * 1
                    if (sjinf == "美卡") {
                        if (Shunhao <= 4) {
                            Shunhao = 4
                        }
                        if (LX.length == 1 && SUNhao <= 0.4) {
                            $("#ZB_jgf").text(0.4)
                        }
                        if (LX.length == 2 && SUNhao <= 0.6) {
                            $("#ZB_jgf").text(0.6)
                        }
                    } else if (sjinf == "AAA") {
                        if (Shunhao <= 4) {
                            Shunhao = 4
                        }
                        if (LX.length == 1 && SUNhao <= 0.1) {
                            $("#ZB_jgf").text(0.1)
                        }
                        if (LX.length == 2 && SUNhao <= 0.3) {
                            $("#ZB_jgf").text(0.3)
                        }
                    } else if (sjinf == "A") {
                        if (Shunhao <= 2) {
                            Shunhao = 2
                        }
                        if (LX.length == 1 && SUNhao <= 0.1) {
                            $("#ZB_jgf").text(0.1)
                        }
                        if (LX.length == 2 && SUNhao <= 0.3) {
                            $("#ZB_jgf").text(0.3)
                        }
                    } else if (LX == "AA" || LX == "AAA") {
                        if (Shunhao <= 8) {
                            Shunhao = 8
                        }
                        if (LX == "AA" && SUNhao <= 1.6) {
                            $("#ZB_jgf").text(1.6)
                        }
                        if (LX == "AAA" && SUNhao <= 3) {
                            $("#ZB_jgf").text(3.0)
                        }
                    } else if (LX == "EF") {
                        Shunhao = 0
                        if (LX == "AAA" && SUNhao <= 1) {
                            $("#ZB_jgf").text(1.0)
                        }
                    }
                    $("#ZB_sh").text(Shunhao)
                })
				Get_SquareGramWeight($(e.target))
			})
            $(document).on("change", ".ZB_CSed", function (e) {
                //循环判断损耗的值
                $(".ZB_CSed").each(function (e, sko) {
                    var sjinf = $(sko).val()
                    var LX = $("#ZB_msed").val()
                    var Shunhao = $("#ZB_shed").text()
                    var SUNhao = $("#ZB_jgfed").text() * 1
                    if (sjinf == "美卡") {
                        if (Shunhao <= 4) {
                            Shunhao = 4
                        }
                        if (LX.length == 1 && SUNhao <= 0.4) {
                            $("#ZB_jgfed").text(0.4)
                        }
                        if (LX.length == 2 && SUNhao <= 0.6) {
                            $("#ZB_jgfed").text(0.6)
                        }
                    } else if (sjinf == "AAA") {
                        if (Shunhao <= 4) {
                            Shunhao = 4
                        }
                        if (LX.length == 1 && SUNhao <= 0.1) {
                            $("#ZB_jgfed").text(0.1)
                        }
                        if (LX.length == 2 && SUNhao <= 0.3) {
                            $("#ZB_jgfed").text(0.3)
                        }
                    } else if (sjinf == "A") {
                        if (Shunhao <= 2) {
                            Shunhao = 2
                        }
                        if (LX.length == 1 && SUNhao <= 0.1) {
                            $("#ZB_jgfed").text(0.1)
                        }
                        if (LX.length == 2 && SUNhao <= 0.3) {
                            $("#ZB_jgfed").text(0.3)
                        }
                    } else if (LX == "AA" || LX == "AAA") {
                        if (Shunhao <= 8) {
                            Shunhao = 8
                        }
                        if (LX == "AA" && SUNhao <= 1.6) {
                            $("#ZB_jgfed").text(1.6)
                        }
                        if (LX == "AAA" && SUNhao <= 3) {
                            $("#ZB_jgfed").text(3.0)
                        }
                    } else if (LX == "EF") {
                        Shunhao = 0
                        if (LX == "AAA" && SUNhao <= 1) {
                            $("#ZB_jgfed").text(1.0)
                        }
                    }
                    $("#ZB_shed").text(Shunhao)
                })
                Get_SquareGramWeight($(e.target))
            })
			//纸箱类型
			$(document).on("change", "#Lei_xin,#ZB_ms", function() {
				var jind = $("#Lei_xin").val()
				if (jind == "2" || jind == "3" || jind == "6") {
					$(".cheshuang").hide()
				} else {
					$(".cheshuang").show()
				}
				if (jind == "1" || jind == "2" || jind == "3" || jind == "4") {
					$("#GUigesed,#shc,#shuangmina,#miji,.pingmo,.guanli").show()
					$("#jinded,.LAjidnd,.Yinfc1,.LAjidnds").hide()
					if (jind == "2" || jind == "3") {
						$("#SHENc tbody").children().eq(4).hide()
						$(".pingmo").hide()
					} else {
						$("#SHENc tbody").children().eq(4).show()
					}
					$(".jskapll").text("@Resource.String1032")
				}
				if (jind == "9") {
					$("#shc,#shuangmina,#miji").show()
					$("#GUigesed,#jinded,.LAjidnd,.Yinfc1,.pingmo,.guanli,.LAjidnds").hide()
					$(".jskapll").text("@Resource.String1032")
				}
				if (jind == "5") {
					$("#shc,#shuangmina,#miji,.guanli").hide()
					$("#GUigesed,#jinded,.LAjidnd,.Yinfc1,.pingmo,.LAjidnds").show()
					$("#Zongjis,#zhongjiseMO,#okkoskse").text("0")
					$(".jskapll").text("@Resource.String1206")
				}
				if (jind == "6" || jind == "7") {
					$("#shc,#shuangmina,#miji,.LAjidnd,#jinded,.pingmo,.guanli").hide()
					$("#KJIND").parent().parent().hide()
					if (jind == "7") {
						$(".pingmo,.LAjidnds").show()
					}
					$("#GUigesed,.Yinfc1,.LAjidnds").show()
					var sjinfjdk = jind == "6" ? "@Resource.String1207" : jind = "7" ? "@Resource.String1208" : ""
					$(".jskapll").text(sjinfjdk)
				}
				if (jind == "8") {
					$("#GUigesed,#shc,#shuangmina,#miji,.LAjidnd,#jinded,.guanli").hide()
					$(".jskapll").text("@Resource.String1209")
					$(".Yinfc1,.pingmo,.LAjidnds").show()
				}
                shujisuhdu()
				Zjkons()
			})
			$(document).on("change", "#CY_Gf", function() {
				$(this).parent().next().children().text($(this).val().split("+")[0])
				Processing()
				Zjkons()
			})
            $(document).on("change", "#CY_GfAW", function (e) {
                var hokl = $(e.target).val() * 1
                var ajndhh = ($('input[name="S_num1"]').val() / 1000 - 0.005)  * 2//制造长
                Lalianxiang(hokl, ajndhh, e.target)
            })
            $(document).on("change", "#Yshidai", function (e) {
                var hokl = $(e.target).val() * 1
                var ajndhh = $('input[name="S_num1"]').val() / 1000 - 0.005//制造长
                Lalianxiang(hokl, ajndhh, e.target)
            })
            function Lalianxiang(Jia, ShuL, e) {
                $(e).parent().next().text(Jia)
                $(e).parent().next().next().text(ShuL.toFixed(4))
                $(e).parent().next().next().next().text((Jia * ShuL).toFixed(4))
                var sji = $('input[name="Z_Cs"]').val()
                var sjitr = $('input[name="Z_Ks"]').val()
                lakiqwdr(sji, sjitr)
                Zjkons()
            }

			function nLPf() {
				var djinf = $("#Lei_xin option:selected").val()
				var Z_c = $('input[name="Z_Cs"]').val()
				var Z_K = $('input[name="Z_Ks"]').val()
				var shinf = $("#yihchuj").val() //模数
				var koodk = $("#kojnnd").text() //纸版价
				var sjifn = $("#kojG").val() //系数
                if (djinf == "1" || djinf == "2" || djinf == "3" || djinf == "4") {
					var shunf = (Z_c * 1 + 20) * ((Z_K * shinf) + 15 * 1) / 1000000 //纸版面积
					var shkdp = shunf * koodk / shinf
					$("#KJIND").text((Z_K * shinf + 15).toFixed(0))
					$("#kojjik").text(shkdp.toFixed(3))
					$("#minajisg").text(shunf.toFixed(3))
					$("#minlps").text((shunf / shinf).toFixed(3))
					$("#weishi").text((shkdp).toFixed(3))
					Zjkons()
				}
				if (djinf == "5") {
					var CDEd = $(".CY_ts").text()
					CDEd = CDEd == "" ? 0 : CDEd;
					var shunf = (Z_c * 1 + 20) * (Z_K * shinf + 15)
					$("#KJIND").text((Z_K * shinf + 15).toFixed(0))
					$("#minajisg").text((shunf / 1000000).toFixed(4))
                    $("#kojjik").text((shunf / 1000000 / shinf * sjifn * koodk).toFixed(4))
					$("#minlps").text((Z_c * Z_K / 1000000).toFixed(4))
					var temp = 0;
					$(".CY_t").each(function(i, item) {
						temp = temp + $(item).text() * 1
					})
					var klo = $("#kojjik").text()
					$("#weishi").text((temp * 1 + klo * 1 + CDEd * 1).toFixed(4))
					Zjkons()
				}
                if (djinf == "6") {
                    var sjifn = $("#kojG").val() //系数
                    var shunf = (Z_c *Z_K ) / 1000000 //纸版面积
                    var shkdp = shunf * koodk / shinf
                    $("#KJIND").text((Z_K * shinf).toFixed(0))
                    $("#kojjik").text(shkdp.toFixed(3))
                    $("#minajisg").text(shunf.toFixed(3))
                    $("#minlps").text((shunf / shinf).toFixed(3))
                    $("#weishi").text((shkdp * sjifn).toFixed(3))
                    Zjkons()
                }
				if ( djinf == "7" || djinf == "8") {
					var sjifn = $("#kojG").val() //系数
					var shunf = (Z_c * 1 + 20) * ((Z_K * shinf) + 15 * 1) / 1000000 //纸版面积
					var shkdp = shunf * koodk / shinf
					$("#KJIND").text((Z_K * shinf + 15).toFixed(0))
					$("#kojjik").text(shkdp.toFixed(3))
					$("#minajisg").text(shunf.toFixed(3))
					$("#minlps").text((shunf / shinf).toFixed(3))
					$("#weishi").text((shkdp * sjifn).toFixed(3))
					Zjkons()
				}
				if (djinf == "9") {
                    var shunf = (Z_c * 1 + 20) * ((Z_K * shinf) + 15 * 1) / 1000000 //纸版面积
                    var shkdp = shunf * koodk / shinf
                    $("#KJIND").text((Z_K * shinf + 15).toFixed(0))
                    $("#kojjik").text(shkdp.toFixed(3))
                    $("#minajisg").text(shunf.toFixed(3))
                    $("#minlps").text((shunf / shinf).toFixed(3))
                    $("#weishi").text((shkdp).toFixed(3))
                    Zjkons()
                }
			}
            $(document).on("keyup", "#yihchuj,#kojG", function() {
				nLPf()
			})
			//使用规格计算体积,input[name='Z_Cs'],input[name='Z_Ks']
			$(document).on("keyup", ".zhnagkai", function() {
				shujisuhdu()
				Zjkons()
			})
			$(document).on("keyup", "#shufn_sed", function() {
				Processing()
				Zjkons()
			})
			$(document).on("keyup", ".ShuangM", function () {
				Processing()
				Zjkons()
			})
			$(document).on("keyup", "input[name='Z_Cs'],input[name='Z_Ks']", function() {
				var Z_c = $('input[name="Z_Cs"]').val() * 1
				var Z_K = $('input[name="Z_Ks"]').val() * 1
				var djinf = $("#Lei_xin option:selected").val()
				var qwed = $("#ZB_HD").text() * 1
				if (djinf == "1" || djinf == "2" || djinf == "3" || djinf == "4" || djinf == "9") {
					jisnnfsdrf(Z_c, Z_K)
				}
				if (djinf == "5") {
					lakiqwdr(Z_c, Z_K)
				}
				if (djinf == "6" || djinf == "7" || djinf == "8") {
					jisnnf(Z_c, Z_K)
				}
				//计算展开面积
				var shukolp = Z_c * Z_K * qwed; //计算体积
				var komlpp = Z_c * Z_K
                $("#mianjiaMO").text((komlpp / 1000000).toFixed(4))
				$("#Tijian").text(shukolp.toFixed(4))
				Zjkons()
			})
			//
			$(document).on("change", "#SY_seld,#SY_jis,#SY_MU", function() {
				var jihe = $(this).val()
				var sjinf = jihe.split("+")[0]
				var Jiehess = $(this).parent().parent().children().eq(0).text()
				var GOao = $('input[name="S_num3"]').val()
				var KUnag = $('input[name="S_num2"]').val()
				var Z_c = $('input[name="Z_Cs"]').val() * 1
				var Z_K = $('input[name="Z_Ks"]').val() * 1
				var sinndd = Z_c * Z_K / 1000000;
				if (sjinf == "jiehe") {
					//计算自定义
					$(this).parent().next().text("")
					$(this).parent().next().append("<input type='number' class='kodnnsiko' min='0'>")
				} else if (Jiehess == "@Resource.String1056") {
					$(this).parent().next().text((sjinf * 1).toFixed(4))
					$(this).parent().next().next().next().text((sjinf * (GOao * 1 + KUnag * 1) / 1000).toFixed(4))
				} else {
					//计算面积
					$(this).parent().next().text((sjinf * 1).toFixed(4))
					$(this).parent().next().next().next().text((sjinf * sinndd).toFixed(4))
				}
				jisnfff()
			})
			$(document).on("change", "#SY_bz", function() {
				var sjinf = $(this).val()
				var qins = $("#SY_bz option:selected").text()
				var Z_K = $('input[name="S_num2"]').val() * 1
				var Z_G = $('input[name="S_num3"]').val() * 1
                if (qins == "人工") {
					var $td1 = $(`<td>人工包装：<input type="number" class="jised" min="0"/>个</td>`)
					$("#SY_bz").parent().next().next().replaceWith($td1)
                }else if (qins == "@Resource.String1054") {
					zuangsin()
				} else {
					var sinndd = (Z_K + Z_G) / 1000;
					$(this).parent().next().text((sjinf * 1).toFixed(4))
					$(this).parent().next().next().text("@Resource.String1025/@Resource.String1210")
					$(this).parent().next().next().next().text((sjinf * sinndd).toFixed(4))
				}
				jisnfff()
			})
			$(document).on("keyup", ".jisna,.jisnas", function() {
				var snd = $(".jisna").val()
				var snded = $(".jisnas").val()
				$(".jisnas").parent().next().text((snd / snded).toFixed(4))
                jisnfff()
			})
			$(document).on("keyup", ".jised", function () {
				$(".jised").parent().next().text($(this).val())
                jisnfff()
            })
			$(document).on("keyup", ".kodnnsiko", function() {
				var lpsjj = $(this).val() * 1
				var Z_c = $('input[name="Z_Cs"]').val() * 1
				var Z_K = $('input[name="Z_Ks"]').val() * 1
				var sinndd = Z_c * Z_K / 1000000;
				$(this).parent().next().next().text((lpsjj * sinndd).toFixed(4))
				jisnfff()
			})
			$(document).on("change", "#Yanse", function() {
				var Z_c = $('input[name="Z_Cs"]').val() * 1
				var Z_K = $('input[name="Z_Ks"]').val() * 1
				var sinndd = Z_c * Z_K / 1000000;
				let A = $(this).val().split("+")[0]
				var shunnwe = A
				$(this).parent().next().text(shunnwe)
				$(this).parent().next().next().next().text((shunnwe * sinndd).toFixed(4))
				jisnfff()
			})
			$(document).on("keyup", ".Guani_s", function() {
				var shifn = $(this).val()
				fuankisj(shifn)
				Zjkons()
			});
			$(document).on("keyup", ".Guani_sjisn", function() {
				var shifn = $(this).val()
				fuisj(shifn)
				Zjkons()
			})
			$(document).on("change", ".kosml", function() {
				sjinf()
			})
			$(document).on("keyup", ".kosmled", function() {
				sjinf()
			})
			$(document).on("change", "#SY_MU", function() {
				var selectedOption1 = this.options[this.selectedIndex].text;
				var select2 = document.getElementById('Dao_m');
				if (selectedOption1 == "重型平模") {
					selectedOption1 = "平模"
				}
				for (var i = 0; i < select2.options.length; i++) {
					if (select2.options[i].text === selectedOption1) {
						select2.options[i].selected = true;
						shudn()
						Zjkons()
						break;
					}
				}
			})
			$(document).on("change", "#Dao_m", function() {
				shudn()
				Zjkons()
			})
			$(document).on("change", "#YUnshijdj", function() {
				var LLMM = $("#YunFBz").val()
				var sjifkks = $("#YUnshijdj option:selected").text()
				if (LLMM == "") {
					alert("@Resource.String1080！")
				} else {
					if (sjifkks == "省外") {
						$(this).parent().next().text("")
						var $inp = $(`<input type="number" id="pRices" />`);
						$(this).parent().next().append($inp)
						return
					} else {
						var sjinfk = $(this).val()
						var kolpo = $("#tijishu").text()
						$(this).parent().next().text(sjinfk)
						$("#Yuhn_s").text((sjinfk * kolpo).toFixed(4))
						Zjkons()
					}
				}
			})
			$(document).on("keyup", "#koqt", function() {
				Zjkons()
			})
			$(document).on("keyup", "#pRices", function() {
				var shidj = $(this).val()
				var kolpo = $("#tijishu").text()
				$(this).parent().next().text(shidj)
				$("#Yuhn_s").text((shidj * kolpo).toFixed(4))
				Zjkons()
			})
		})
		//确定功能--提交进入下一页
		$(function () {
			if ($("#ssdnf").text() == "重新配置") {
                $("#log_back").css({"display":"none"})
                $("#FanhuiJK").css({ "display": "block" })
			}
			$("#FanhuiJK").click(function () {
                window.location.href = "/Home/GYBOM"
            })
			$("#Quebecs").click(function() {
				var hu = $("#shenDan").text();
				var index2=0
				$("#BoTa tr").each(function(index, obj) {
                    var xxx = $("td[id=DanJe_sel]",obj).text()
					if (xxx == "木箱" || xxx == "木托盘" || xxx == "缓冲材" || xxx == "气泡袋" || xxx == "气泡枕" || xxx == "葫芦膜" || xxx == "胶带" || xxx == "缠绕膜" || xxx == "塑料袋" || xxx == "吸塑" || xxx == "彩印纸箱" || xxx == "水印拉链箱" || xxx == "水印瓦楞箱") {
                        if ($("td[id=liliojsg]", obj).text() == "0.00000" || $("td[id=liliojsg]", obj).text() == "" || $("td[id=liliojsg]", obj).text() == "0") {
							index2++
						}
					}
				})

				if (index2 == 0) {
                    $.ajax({
                        url: '/Material/cghangessw',
                        type: 'POST',
                        data: { "hu": hu },
						success: function (date) {

                            $.ajax({
                                url: '/Material/djkebd',
                                type: 'POST',
                                data: { "bu": date },
                                success: function (date2) {
									alert(date2+1111)
                                    CG_XX = []
                                    $("#BoTa tr").each(function (i, obj) {
                                        CG_XX.push({
                                            FM_bai: $("#liao", obj).text(),
                                        })
                                        console.log("共" + CG_XX.length + "数据");
                                        console.log(CG_XX);
									})
                                    $.ajax({
                                        url: "/Formations/DGwlSC",
                                        type: 'POST',
                                        data: { "Bian": CG_XX },
                                        success: function (text) {
                                            $("#Pinzh").hide()
                                            alert(text)
                                        },
                                        error: function (text) {
                                            alert("系统错误");
                                        }
                                    })
                                },
                                error: function () {
                                    alert("错误 请重试！")
                                }
                            })
                        },
                        error: function () {
                            alert("错误 请重试！")
                        }
					})
				}
				else {
					alert("还有物料未进行成本分析")
				}
				//function xiugai() {
				//	var BOMinise = []
				//	$("#BoTa tr").each(function(index, obj) {
				//		BOMinise.push({
				//			BOM2_id: $("#CG_INFSQD", obj).text(),
				//			BOM2_Jin: $("input[name='Jingoyng']:checked", obj).val()
				//		})
				//	})
				//	var Sji = $("#BoTa tr").length
				//	$.ajax({
				//		url: '/Material/bomini',
				//		type: 'POST',
				//		data: JSON.stringify(BOMinise),
				//		contentType: "application/json;charset=utf-8",
				//		dataType: "json",
				//		success: function(e) {
				//			if (e == Sji) {
				//				shunji = 1;
				//			}
				//		},
				//		error: function() {
				//			alert("系统有误--！");
				//		}
				//	})
				//}
			})
		})

		//木制品
		//加载更新
		//替换材料的损耗
		function hsuhdmkl() {
			var JSIFN = $("#MUTO option:selected").val() //1--木托盘。2--木箱
			var select2 = document.getElementById("MZ_RG");
			var ShuxDW = 0;
			var lskoam;
			if (JSIFN == "1") {
				ShuxDW = 2
				lskoam = "托盘人工"
			}
			if (JSIFN == "2") {
				ShuxDW = 7//百分比
				lskoam = "木箱人工"
			}
			hihiKK(ShuxDW)
			$("#SHJNK").val(ShuxDW)
			for (var i = 0; i < select2.options.length; i++) {
				console.log(select2.options[i].text)
				if (select2.options[i].text == lskoam) {
					select2.options[i].selected = true;
					var jia = select2.options[i].value
					var Ztj = $("#ALL_MCTJ").text()
					var jgf_tj = jia * Ztj
					$("#MZ_RG").parent().next().text(jgf_tj)
				}
			}

            var sum = 0
            $(".MZ_jgf").each(function (i, item) {
                sum += $(item).val() * 1
            })
            var rg = $("#MZ_RGF").text() * 1
            $("#ALL_jgf").text(sum + rg)
		}
		//替换材料的损耗
		function hihiKK(JFND) {
			var sjnf = document.getElementById("XUANJI");
			for (var i = 0, row; row = sjnf.rows[i]; i++) {
				// 遍历每一列
				for (var j = 0, cell; cell = row.cells[j]; j++) {
					// 修改第一列的值
					if (j === 9) {
						cell.textContent = JFND*0.01; // 或 cell.innerText = '新的值';
					}
				}
			}
		}

		function sxunf(ksoms) {
			var CD = $("#MZ_C").val() * 1
			var CK = $("#MZ_K").val() * 1
			var CG = $("#MZ_G").val() * 1
			var mians = (CD * CK) / 1000000; //tiji
			var tijiss = (CD * CK * CG) / 1000000000; //mianji
			var sjinf = $("#MUTO option:selected").val()
			var jiages = 0;
			var jilu = 0; //记录选项
			if (sjinf == "1") {
				if ($("#ksmwww").text() <= 30 && CG <= 160) {
					jilu = ""
				}
				if (mians > 1.5) {
					jilu = "木托盘（面积>1.5平方米）"
				} else if (mians >= 0.5) {
					jilu = "木托盘（面积≤1.5平方米）"
				} else {
					jilu = "木托盘（面积≤0.5平方米）"
				}
			}
			if (sjinf == "2") {
				if ($("#CFkosmd").prop("checked")) {
					jilu = "木箱（成品）"
				} else {
					if (CG >= 2000) {
						jilu = "木箱（半成品，高度≥2米）"
					} else if (CG >= 1000) {
						jilu = "木箱（半成品，高度≤2米）"
					} else {
						jilu = "木箱（半成品，高度≤1米）"
					}
				}
			}
			var sjinf = document.getElementById("Ren_chu")
			var ksoms;
			for (var i = 0; i < sjinf.options.length; i++) {
				if (sjinf.options[i].text == jilu) {
					sjinf.options[i].selected = true;
					ksoms = sjinf.options[i].value
				}
			}
			var jie = ksoms.split('+')
			var Ren_jia = jie[1] * 1 //价格
			if (sjinf == "1") {
				if ($("#ksmwww").text() <= 30 && CG <= 160) {
					jiages = Ren_jia * mians
				}
				if (mians > 1.5) {
					jiages = Ren_jia * mians
				} else if (mians >= 0.5) {
					jiages = Ren_jia
				} else {
					jiages = Ren_jia
				}
			}
			if (sjinf == "2") {
				if ($("#CFkosmd").prop("checked")) {
					jiages = Ren_jia * tijiss
				} else {
					if (CG >= 2000) {
						jiages = Ren_jia * mians
					} else if (CG >= 1000) {
						jiages = Ren_jia * mians
					} else {
						jiages = Ren_jia * mians
					}
				}
			}
			$("#Ren_chu").parent().next().text(Ren_jia.toFixed(3))
			$("#Ren_chu").parent().next().next().text((mians * 1).toFixed(3))
			$("#Ren_chu").parent().next().next().next().text((tijiss * 1).toFixed(3))
			$("#RC_YSFXJ").text(jiages)
		}
		//计算总价
        function zhongjia() {
            var Mucai = $("#ALL_MCF").text() * 1
            var Fuliao = $("#ALL_FLF").text() * 1
            var Jiagong = $("#ALL_jgf").text() * 1
            var Yunshu = $("#MZ_YSFXJ").text() * 1
            var Renchuli = $("#RC_YSFXJ").text() * 1
            var Sunm = Mucai + Fuliao + Jiagong + Yunshu + Renchuli
            $("#Zongji").text(Sunm)
        }

		$(function() {


			//计算辅料价格
			function accessory(e) {
				var s = e.val() * 1
				var j = e.parent().next().text() * 1
				e.parent().next().next().text(s * j)
				var sum = 0
				$(".MZ_FLF").each(function(i, item) {
					sum += $(item).text() * 1
				})
				$("#ALL_FLF").text(sum)
				zhongjia()
			}
			//计算木材体积和价格
			function Calculated_Volume2(e) {
				var c = e.parent().parent().children().eq(3).children().val()
				var k = e.parent().parent().children().eq(4).children().val()
				var g = e.parent().parent().children().eq(6).children().val()
				var s = e.parent().parent().children().eq(7).children().val()
				var sh = e.parent().parent().children().eq(9).text()
				var j = e.parent().parent().children().eq(10).text()
				var m3 = c * k * g * s / 1000000000
				e.parent().parent().children().eq(8).text((m3).toFixed(4))
				e.parent().parent().children().eq(11).text(((m3 * j) * (1 + sh * 1)).toFixed(4))
				var sum = 0
				var num = 0
				$(".MZ_MCF").each(function(i, item) {
					sum += $(item).text() * 1
				})

				$("#ALL_MCF").text(sum.toFixed(4))
				$(".MZ_TJ").each(function(j, obj) {
					num += $(obj).text() * 1
				})

				$("#ALL_MCTJ").text(num.toFixed(4))




				zhongjia()
                hsuhdmkl()
			}
			//根据材料类别获取损耗和立方价格
			function Wear_Price_w_ZL(e) {
				var lei = e.val()
				console.log(lei)
				$.ajax({
					url: "/Procure/woodwork",
					type: 'GET',
					data: {
						"state": 2,
						"miaoshu": lei
					},
					success: function(data) {
						$.each(data, function(i, item) {
							e.parent().parent().children().eq(10).text(item.PA_T)
						})
						Calculated_Volume2(e)
					},
					error: function() {
						alert('Request Error');
					}
				})
			}
			//新增木材费表格行
			function Add_table_row_Timber(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(`
										<tr>
											<td></td>
											<td>
												<input type="text" style="width:60px;height:25px" />
											</td>
											<td>
												<select class="MZ_CL" style="width:130px;height:25px" id="MZ_CL">
													<option value="0">@Resource.String1144</option>
													@foreach (var item in ViewBag.parice as List<parice>)
													{
														if (item.PA_Shuxing == 1)
														{
															<option value="@item.PA_ZhongL">@item.PA_ZhongL</option>
														}
													}
												</select>
											</td>
											<td>
												<input type="number" class="MZ_gg" id="mz_c" style="width:60px;height:25px" />
											</td>
											<td>
												<input type="number" class="MZ_gg" id="mz_k" style="width:60px;height:25px" />
											</td>
											<td>
												<input type="number" class="MZ_gg" id="mz_g" style="width:60px;height:25px" />
											</td>
											<td>
												<input type="number" class="MZ_gg" id="mz_sj" style="width:60px;height:25px" />
											</td>
											<td>
												<input type="number" class="MZ_gg" id="MZ_shuliang" name="MZ_SL" style="width:60px;height:25px" />
											</td>
											<td class="MZ_TJ" id="MZ_TJ"></td>
											<td id="mz_sh"></td>
											<td id="mz_lfj"></td>
											<td class="MZ_MCF" id="MZ_MC"></td>
											<td>
												<a href="#" id="MZ_CZ">@Resource.String1063</a>
											</td>
										</tr>
									 `);
					e.parent().parent().parent().append($tr)
					var sum = 0
					var num = 0
					$(".MZ_MCF").each(function(i, item) {
						sum += $(item).text() * 1
					})
					$("#ALL_MCF").text(sum)
					$(".MZ_TJ").each(function(j, obj) {
						num += $(obj).text() * 1
					})
					$("#ALL_MCTJ").text(num)
					hihiKK($("#SHJNK").val())
					zhongjia()
				} else {
					e.parent().parent().remove()
					var sum = 0
					var num = 0
					$(".MZ_MCF").each(function(i, item) {
						sum += $(item).text() * 1
					})
					$("#ALL_MCF").text(sum)
					$(".MZ_TJ").each(function(j, obj) {
						num += $(obj).text() * 1
					})
					$("#ALL_MCTJ").text(num)
					hihiKK($("#SHJNK").val())
					zhongjia()
				}
			}
			//新增辅件费用表格行
			function Add_table_row_accessory(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(`
							<tr>
								<td></td>
								<td>
									<select style="width:130px;height:25px"  id="MZ_FL">
										<option value="djdd">@Resource.String1144</option>
										@foreach (var item in ViewBag.parice as List<parice>)
										{
											if (item.PA_Shuxing == 6)
											{
												<option value="@item.PA_T+@item.PA_ZhongL">@item.PA_ZhongL</option>
											}

										}
									</select>
								</td>
								<td><input type="number" style="width:60px;height:25px" id="MZ_FLSL"/></td>
								<td></td>
								<td class="MZ_FLF" id="MZ_FLF"></td>
								<td><a href="#" id="MZ_FLH">@Resource.String1063</a></td>
							</tr>
									 `);
					e.parent().parent().parent().append($tr)
					var sum = 0
					$(".MZ_FLF").each(function(i, item) {
						sum += $(item).text() * 1
					})
					$("#ALL_FLF").text(sum)
					zhongjia()
				} else {
					e.parent().parent().remove()
					var sum = 0
					$(".MZ_FLF").each(function(i, item) {
						sum += $(item).text() * 1
					})
					$("#ALL_FLF").text(sum)
					zhongjia()
				}
			}
			//新增加工费
			function Add_table_row_Processing(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(`
										<tr>
											<td><input type="text" id="MZ_gymc" style="width:100px;height:25px" placeholder="@Resource.String1211" /></td>
											<td><input type="number" class="MZ_jgf" style="width:100px;height:25px"placeholder="@Resource.String1148"/></td>
											<td><a href="#" id="MZ_JGFH">@Resource.String1063</a></td>
										</tr>
									 `);
					e.parent().parent().parent().append($tr)
				} else {
					e.parent().parent().remove()
				}
			}
			//切换二级分类来触发事件
			function Search_SrocessingFee() {
				var miaoshu = $("#MZP_ms").val()
				$.ajax({
					url: "/Procure/woodwork",
					type: 'GET',
					data: {
						"state": 1,
						"miaoshu": miaoshu
					},
					success: function(data) {
						$.each(data, function(i, item) {
							$("#MZP_jgf").text(item.LB_jia)
						})
					},
					error: function() {
						alert('Request Error');
					}
				})
			}
			//计算运输费小计
			function Transportation_charges_subtotal() {
				console.log()
				var num = $("#MZ_ZCSL").val() * 1
				var all = $("#MZ_YSF").val() * 1
				console.log(all)
				console.log(num)
				sub = all / num
				$("#MZ_YSFXJ").text(sub.toFixed(4))
				zhongjia()
			}
			//计算总加工费
			function Processing_cost() {
				var sum = 0
				$(".MZ_jgf").each(function(i, item) {
					sum += $(item).val() * 1
				})
				var rg = $("#MZ_RGF").text() * 1
				$("#ALL_jgf").text(sum + rg)
				zhongjia()
			}

			$(document).on("keyup", ".MZ_jgf", function(i, item) {
				Processing_cost()
			})
			//修改加工费(木箱/托盘)
			$(document).on("change", "#MZ_RG", function(e) {
				var jia = $(e.target).val()
				var Ztj = $("#ALL_MCTJ").text()
				var jgf_tj = jia * Ztj
				$(e.target).parent().next().text(jgf_tj)
                Processing_cost()
			})
			//输入运输费和装车数量
			$(document).on("keyup", ".MZ_YS", function(e) {
				Transportation_charges_subtotal()
			})
			//辅料费的添加/删除
			$(document).on("click", "#MZ_FLH", function(e) {
				Add_table_row_accessory($(e.target))
			})
			//成品事件
			$(document).on("click", "#CFkosmd", function() {
				sxunf()
				dwddd()
			})
			//加工费的添加/删除
			$(document).on("click", "#MZ_JGFH", function(e) {
				Add_table_row_Processing($(e.target))
				Processing_cost()
			})
			//输入辅料数量
			$(document).on("keyup", "#MZ_FLSL", function(e) {
				accessory($(e.target))
			})
			//退出按钮
			$("#Tuichu").click(function() {
				$("#jsmb").hide()
			})
			//切换辅料名来切换单价
			$(document).on("change", "#MZ_FL", function(e) {
				var dj = $(e.target).val()
				var dj2 = dj.split("+")
				var dj3 = dj2[0]
				console.log(dj3)
				var s = $(e.target).parent().next().children().val()
				$(e.target).parent().next().next().text(dj3)
				$(e.target).parent().next().next().next().text(dj3 * s)
			})
			//输入木材规格
			$(document).on("keyup", ".MZ_gg", function(e) {
				Calculated_Volume2($(e.target))

			})
			//下拉框修改木材的材料类别
			$(document).on("change", "#MZ_CL", function(e) {
				Wear_Price_w_ZL($(e.target))
			})
			//木材费的添加/删除
			$(document).on("click", "#MZ_CZ", function(e) {
				Add_table_row_Timber($(e.target))
			})
			$(document).on("click", "#MZP_ms", function(e) {
				Search_SrocessingFee()
			})
			//切换物料属性更换损耗
			$(document).on("change", "#MUTO", function() {
				hsuhdmkl()
			})
			$(document).on("keyup", "#SHJNK", function() {
				hsuhdmkl()
			})
			//切换热处理名称来切换单价
			$("#Ren_chu").change(function(e) {
                dwddd(e)
			})

			//传递到后台
			$("#Queding").click(function() {
				var name = $("#wulm").text()
                var lh = $("#bomindy").text()
				var fl1 = $("#flelei").text()
				var fl2 = $("#fellei2").text()
				var gyjl = {
					wl_name: name,
					wl_liao: lh,
					wl_fen: fl1,
					wu_fenLei: fl2,
					wl_c: $("#MZ_C").val(),//长
                    wl_k: $("#MZ_K").val(),//宽
					wl_g: $("#MZ_G").val(),//高
					wl_leng: $("select[id=Ren_chu]").val(),//热处理类型
					wl_m: $("#RC_YSFXJ").text(),//热处理小计
					wl_mj: $("#MZ_YSF").val(),//运输费
					wl_ll: $("#MZ_ZCSL").val(),//装车数量
					wl_sj: $("#MZ_YSFXJ").text(),//运输费小计
					wl_h: $("#Zongji").text()//总计
				}
				console.log(gyjl)
				$.ajax({
					url: '/Material/AddProcessRecord',
					type: 'POST',
					data: gyjl,
					success: function (data) {
						var GYLC_CL = [];
						var GYLC_GY = [];
						if (fl1 == "2") {
							//木材费
							$("#MZ_MCF tr").each(function (index, obj) {
								var Thuan = "";
								if ($("td[id='MZ_MC']", obj).text() != "") {
									if ($("select[id='MZ_CL']", obj).val() != "0") {
										$.ajax({
											url: "/Material/Addpaid",
											type: 'GET',
											data: {
												"name": $("select[id='MZ_CL']", obj).val()
											},
                                            success: function (data1) {
                                                $("#knds").text(data1)
											},
											error: function() {
												alert('Request Error');
											}
										})
                                        var Thuan = $("#knds").text()
                                        GYLC_CL.push({
                                            cl_id: Thuan,
                                            prrw_jia: $("td[id='MZ_MC']", obj).text(),
                                            prrw_guige: $("td[id=mz_lfj]", obj).text(),
                                            prrw_shu: $("input[name='MZ_SL']", obj).val(),
                                            prr_id: data,
                                            prrw_zc: $("select[id=MZ_CL]", obj).val(),
                                            prrw_c: $("input[id=mz_c]", obj).val(),
                                            prrw_k: $("input[id=mz_k]", obj).val(),
                                            prrw_g: $("input[id=mz_sj]", obj).val(),
                                            prrw_sh: $("td[id=mz_sh]", obj).val(),


                                        })
									}

								}

							})

                            $("#MZ_MCF2 tr").each(function (index, obj) {
								var Thuan = "";
                                if ($("select[id=MZ_FL]", obj).val() != "djdd") {
									if ($("input[id=MZ_FLSL]", obj).val() != "0" && $("input[id=MZ_FLSL]", obj).val() != null) {
										var swhdj = $("select[id=MZ_FL]", obj).val().split("+")
										var jskdj=swhdj[1]
                                        $.ajax({
                                            url: "/Material/Addpaid",
                                            type: 'GET',
                                            data: {
                                                "name": jskdj
                                            },
                                            success: function (data1) {
                                                $("#knds").text(data1)
                                            },
                                            error: function () {
                                                alert('Request Error');
                                            }
                                        })
                                        var Thuan = $("#knds").text()
                                        GYLC_CL.push({
                                            cl_id: Thuan,
                                            prrw_jia: $("td[id=MZ_FLF]", obj).text(),
                                            prrw_guige: "辅料",
                                            prrw_shu: $("input[id=MZ_FLSL]", obj).val(),
                                            prr_id: data,
                                            prrw_zc: $("select[id=MZ_FL]", obj).val(),
                                        })
                                    }

								}


							})

                            console.log(GYLC_CL+"wdddd")
							$.ajax({
								url: "/Material/addCraftMaterials",
								type: "POST",
								data: JSON.stringify(GYLC_CL),
								contentType: "application/json;charset=utf-8",
								dataType: "json",
								success: function(text) {
									console.log(text)
								},
								error: function(text) {
									alert("系统错误" + text);
								}
							})

							$("#gyfffjd tr").each(function (i, wd) {

								var dkd = $("input[id=MZ_gymc]", wd).val()

								if (dkd != null && dkd != "") {
                                    GYLC_GY.push({
                                        pfw_jia: $("input[class=MZ_jgf]", wd).val(),
                                        prr_id: data,
                                        pfw_zc: $("input[id=MZ_gymc]", wd).val(),
                                        CL_beizhu: "其他工艺"
                                    })
								}
                                console.log("共" + GYLC_GY.length + "数据");
                                console.log(GYLC_GY);

							})
                            GYLC_GY.push({
                                pfw_zc: $("select[id=MZ_RG]").val(),
                                prr_id: data,
                                pfw_jia: $("td[id=MZ_RGF]").text(),
								CL_beizhu:"加工费"
							})

                            $.ajax({
                                url: "/Material/addProcessFlow",
                                type: "POST",
                                data: JSON.stringify(GYLC_GY),
                                contentType: "application/json;charset=utf-8",
                                dataType: "json",
                                success: function (text) {
                                    console.log(text)
                                },
                                error: function (text) {
                                    alert("系统错误" + text);
                                }
                            })
						}
					},
					error: function() {
						alert("系统错误");
					}
				})

				var OPtas = {
					OP_price: $("#Zongji").text(),
					OP_YUN: $("#MZ_YSFXJ").text(),
					OP_CAi: $("#ALL_MCF").text(),
					OP_JIA: $("#ALL_jgf").text(),
					OP_GUAN: $("#Giuanlifei").text(),
					OP_LR: $("#LIren").text()
				}
                $.ajax({
                    url: '/Material/APPoptiosjn',
                    type: 'POST',
                    data: {
                        "OPtas": OPtas,
                        "BOM2_id": BOM2_ids,
                        "stannd": 1
                    },
                    success: function (e) {
                        alert(e);
                        $("#SHUliao").css("display", "none");
                        location.reload(true);

                    },
                    error: function () {
                        alert("系统错误");
                    }
                })
			})
		})

        function dwddd() {
            var ghjkl = $("#Ren_chu").val()
            //var ghjkl = $(e.target).val()
            var jie = ghjkl.split('+')
            var zhunag = jie[0] //状态判断
            var Ren_jia = jie[1] //价格
            //获取规格
            var llkong = $("#MZ_C").val()
            var llkuan = $("#MZ_K").val()
            var llgao = $("#MZ_G").val()
			var J_price = 0;
            console.log(ghjkl)
            switch (zhunag) {
                case "1":
                    J_price = llkong / 1000 * llkuan / 1000 * Ren_jia
                    break;
                case "2":
                    J_price = llkong / 1000 * llkuan / 1000 * llgao / 1000 * Ren_jia
                    break;
                case "3":
                    J_price = Ren_jia
                    break;
                default:
                    break;
            }

            $("#Xinxi td:nth-child(3)").text((Ren_jia * 1).toFixed(3))
            $("#Xinxi td:nth-child(4)").text((llkong / 1000 * llkuan / 1000).toFixed(3))
            $("#Xinxi td:nth-child(5)").text((llkong / 1000 * llkuan / 1000 * llgao / 1000).toFixed(3))
            $("#RC_YSFXJ").text(J_price)
            zhongjia()
        }
		//彩印计算---------
		//计算初始值
		function hdhfjjjd() {
			var cycs = $("#CY_xian tr td:nth-child(1)").text() * 1 //净尺寸
			var cyks = $("#CY_xian tr td:nth-child(2)").text() * 1 //门幅
			var ksnif = $("#CY_xian tr td:nth-child(3)").text() * 1 //面纸长
			var CY_ges = $("#CY_ge").val() * 1 //模数
            var CY_Lenz = $("#CY_ERP").text() * 1
			var CYjiagon = cycs / 1000 * ksnif / 1000 / CY_ges //加工面积
			//面积：cyks*ksnif/1000000/CY_ges
			var mianjigs = ((cyks * ksnif) / 1000000) / CY_ges //面纸面积
			var mianjigsed = 0 //面纸单价
			if ($("#SyMbS").prop("checked") && $(".lPsKO").prop("checked")) {
                mianjigsed += $("#ZAQWsx").text() * 1 * mianjigs
                console.log($("#ZAQWsx").text() * 1, mianjigsed, 909)
			} else {
                $(".ZB_Minazhi_Price").each(function (a, item) {
                    mianjigsed += $(item).text() * 1 * mianjigs
                    console.log($(item).text() * 1, mianjigsed, 909)
                })
            }
            $("#LenzhiC").text(cycs.toFixed(0))
            $("#LenzhiK").text(ksnif.toFixed(0))
			$("#CY_xian tr td:nth-child(5)").text(mianjigs.toFixed(5))
			$("#CY_xian tr td:nth-child(8)").text(mianjigsed.toFixed(5))
            $("#CY_xian tr td:nth-child(9),#LenzhiS").text(CYjiagon.toFixed(5))
			$("#CY_xian tr td:nth-child(11)").text((CYjiagon * CY_Lenz).toFixed(5))
			var CYzhong = mianjigsed * 1 + (CYjiagon * 1 * CY_Lenz)
            console.log(mianjigsed, CYjiagon, CY_Lenz, mianjigsed * 1 + (CYjiagon * 1 * CY_Lenz))
			$("#Zjgkgond").text(CYzhong.toFixed(3))
			Averageprice()
			hdufh()
		}
		//合计
		function hdufh() {
			var jisn = 1;
			if ($("#shidjdi").prop("checked")) {
				jisn = 2;
			}
			var KJJFN = $("#Lei_xined").val()
			var shunfn = $("#Zjgkgond").text() * 1 //材料总费用
			var hhdnk = $("#CYst").text() * 1 //表面处理
			var hding = $("#CYL_jgf").text() * 1 //辅料
			var qodkm = $("#okkosk").text() * 1 //撕拉条
			var hdjisn = $("#CYY_jsijn").text() * 1 //包装费
			//var sjihe = $("#CY_jiehea").text() * 1//
			//var sjiheSW = $("#WESH").text() * 1 //拉链箱
			var Avgpri = $(".Avgpri").text() * 1 //上机费
			var shunnn = shunfn + hhdnk + hding + qodkm + hdjisn + Avgpri;//合计(无损耗)
			var shunnnedde = shunfn + hhdnk + hding + qodkm + hdjisn ;//合计(无损耗，无阶梯)
			shunfhao = shunnn * 0.03//损耗
            var Summed = shunfn + hhdnk + hding + qodkm + hdjisn + shunfhao + Avgpri;//合计（有损耗）
			$("#CY_shuan").text(shunfhao.toFixed(5)) //sunhao
            $("#shugnd").text(shunnnedde.toFixed(3)) //zhongjia
            $("#shugndwsq").text((Summed * jisn).toFixed(3))
		}

		function Averageprice() {
			var AA = $("#CY_ge").val() * 1 //模数
			var AAC = $("#JCSCH_Pic").text() * 1 //价格
			var Shuji = 3000; //阶梯价\
			var V = 0 //实际张数
			var ShujiHUJJ = Shuji * AA //标准阶梯价
            $("#BZ_jieti").text(ShujiHUJJ)
            if (V >= ShujiHUJJ || V == 0) {
				$(this).parent().parent().children().eq(4).children().text("0")
            } else if (V < ShujiHUJJ) {
				$(this).parent().parent().children().eq(4).children().text((AAC / V).toFixed(4))
			}
		}
		$(function () {
			$(document).on("click", "#DanJe", function (e) {
				setTimeout(function () {
					var wiliaoerji = $(e.target).parent().parent().children().eq(11).text() // 二级分类
                    if (wiliaoerji =="彩印纸箱") {
                        zhsun_K_sji()
                    }

                }, 1500);
			})
			//执行
			function zhsun_K_sji() {
                var Intid = $("#bomindy").text()
                $.ajax({
                    url: '/Material/GongYiHuiFU',
                    type: 'POST',
                    data: { "Bomid": Intid, "state": 1 },
					success: function (e) {
                        if (e.length > 0) {
							$.each(e, function (i, item) {
                                var DFRE = item.wl_xing == "" ? "1" : item.wl_xing;
                                $("#Lei_xined").val(DFRE)
								$("#Lei_xined").trigger('change')
								$("#ZB_msed").val(item.wl_leng)
                                $("#ZB_msed").trigger('change')
								if (item.wl_xing == 5) {
									var GUISWDE = item.wl_gui.split('*')
                                    var HEFI = GUISWDE[0]
                                    var HEFIF = GUISWDE[1]
                                    $("#CY_ZKC").val(HEFI)
                                    $("#CY_ZKK").val(HEFIF)
								}
                                $("#CY_ZKK").trigger('keyup')
							})
                            //返回物料
                            $.ajax({
                                url: '/Material/GongYiHuiFU',
                                type: 'POST',
                                data: { "Bomid": Intid, "state": 2 },
                                success: function (Aed) {
									var Thuanzhi = 0
									if (Aed.length == 2 || Aed.length == 4 || Aed.length == 4) {
										$(".lPsKO").trigger("click")
                                    }
                                    $(".ZB_CSed").each(function (index, element) {
                                        if (Aed[Thuanzhi].PA_LengBie != "") {
                                            $(element).val(Aed[Thuanzhi].PA_LengBie).trigger('change');
                                        }
                                        var relatedSelect = $(element).parent().parent().children().eq(2).children();
                                        if (relatedSelect.is('select')) { // 确保确实是一个 select 元素
                                            for (var i = 0; i < relatedSelect[0].options.length; i++) {
                                                var optionValueParts = relatedSelect[0].options[i].value.split('+');
                                                if (optionValueParts.length > 1 && optionValueParts[1] === Aed[Thuanzhi].PA_ID) {
                                                    relatedSelect[0].options[i].selected = true;
													relatedSelect.trigger('change');
													console.log(11)
                                                    break;
                                                }
                                            }
                                        }

                                        Thuanzhi++;
                                    });
                                },
                                error: function () {
                                    alert("系统错误");
                                }
							})
                            //返回工艺
                            $.ajax({
                                url: '/Material/GongYiHuiFU',
                                type: 'POST',
                                data: { "Bomid": Intid, "state": 3 },
								success: function (Aed) {
                                    var Biaomian = [];
                                    var caiying = [];
									var biaoleng = [];
									var Fuliado = [];
                                    console.log(Aed)
									$.each(Aed, function (i, item) {
										if (item.BeiZ == "表面处理") {
											Biaomian.push({
                                                name: item.JiaoG,
                                                mian: item.pfw_Zhengfan
											})
										}
                                        if (item.BeiZ == "印刷") {
                                            caiying.push({
                                                name: item.JiaoG,
												mian: item.pfw_Zhengfan,
												SE: item.jiage
                                            })
										}
                                        if (item.BeiZ == "裱楞") {
                                            biaoleng.push({
                                                name: item.JiaoG,
                                                mian: item.pfw_Zhengfan
                                            })
										}
                                        if (item.BeiZ == "塑料提手" || item.BeiZ == "手提绳" || item.BeiZ == "塑料扣" || item.BeiZ == "塑料窗") {
                                            Fuliado.push({
                                                name: item.BeiZ,
												mian: item.pfw_Zhengfan,
												KlO: item.jiage,
												SHU:item.JUn
                                            })
										}
                                        if (item.BeiZ == "包装费用" || item.BeiZ == "纸包边" || item.BeiZ == "纸全封闭打包" || item.BeiZ == "纸箱包装") {
											var shunf = item.BeiZ == "包装费用" ? 1 : item.BeiZ == "纸包边" ? 2 : item.BeiZ == "纸全封闭打包" ? 3 : item.BeiZ == "纸箱包装" ? 4 : 0;
											$("#CY_baoz").find('option:eq(' + shunf + ')').attr('selected', 'selected');
											$("#CY_baoz").trigger("change")
                                        }
										//填充单个的工艺
										$(".YS_GFESHI").each(function (i, LP) {
											var T = $(LP).parent().parent().children().eq(0).text()//行的第一个
											if (item.BeiZ == T && item.BeiZ != "表面处理" && item.BeiZ != "裱楞" && item.BeiZ != "印刷") {
												$(LP).parent().parent().children().eq(2).children().val(item.JiaoG)
                                                $(LP).trigger("change")
											}
										})
										$(".CYSFL").each(function (i, FL) {
											var shund = $(FL).find('option:eq(1)').text();
                                            if (item.BeiZ == "双面胶" && shund=="双面胶") {
												$("#shufn_s").val(item.ZC)
												$(FL).find('option:eq(1)').attr('selected', 'selected');
                                                $(FL).trigger("change")
											}
                                            if (item.BeiZ == "撕拉条" && shund == "撕拉条") {
												$("#shufn_s").val(item.ZC)
												$(FL).find('option:eq(1)').attr('selected', 'selected');
                                                $(FL).trigger("change")
											}
										})
									})
									//遍历集合
									Biaomian.forEach(function (HUJ, BM) {
										var shufn = Biaomian.length
										if (shufn > 1) {
											for (var i = 0; i < shufn - 1; i++) {
												$(".LLPKKDD").trigger("click")
											}
										}
										$(".LLPKKDD").each(function (i, KL) {
                                            $(KL).parent().children().eq(1).children().val(HUJ.mian)
                                            $(KL).parent().children().eq(2).children().val(HUJ.name)
                                            $(KL).parent().children().eq(2).children().trigger("change")
										})
									});
                                    caiying.forEach(function (HUJ, BM) {
                                        var shufn = caiying.length
										if (shufn > 1) {
											for (var i = 0; i < shufn - 1; i++) {
                                                $(".KOMMm").trigger("click")
											}
										}
										$(".KOMMm").each(function (i, KL) {
                                            $(KL).parent().children().eq(1).children().val(HUJ.mian)
                                            $(KL).parent().children().eq(2).children().val(HUJ.name)
                                            $(KL).parent().children().eq(2).children().trigger("change")
										})
									});
                                    biaoleng.forEach(function (HUJ, BM) {
										var shufn = Biaomian.length
										if (shufn > 1) {
											for (var i = 0; i < shufn - 1; i++) {
                                                $(".BiaolenB").trigger("click")
											}
										}
										$(".BiaolenB").each(function (i, KL) {
                                            $(KL).parent().children().eq(1).children().val(HUJ.mian)
                                            $(KL).parent().children().eq(2).children().val(HUJ.name)
                                            $(KL).parent().children().eq(2).children().trigger("change")
										})
									});
                                    Fuliado.forEach(function (HUJ, BM) {
                                        var shufn = Fuliado.length
                                        if (shufn > 1) {
                                            for (var i = 0; i < shufn - 1; i++) {
                                                $("#CY_JGFH").trigger("click")
                                            }
                                        }
                                        $(".CYFZL").each(function (i, KL) {
                                            if (HUJ.name =="塑料提手") {
                                                $(KL).find('option:eq(1)').attr('selected', 'selected');
											} else if (HUJ.name == "手提绳") {
                                                $(KL).find('option:eq(2)').attr('selected', 'selected');
                                            }else if (HUJ.name =="塑料扣") {
                                                $(KL).find('option:eq(3)').attr('selected', 'selected');
                                            } else if (HUJ.name =="塑料窗") {
                                                $(KL).find('option:eq(4)').attr('selected', 'selected');
											}
											$(KL).parent().parent().children().eq(1).children().val(HUJ.KlO)
                                            $(KL).parent().parent().children().eq(2).children().val(HUJ.SHU)
                                            $(KL).parent().parent().children().eq(2).children().trigger("keyup")
                                        })
                                    })
                                },
                                error: function () {
                                    alert("系统错误");
                                }
							})
							//返回阶梯 价格
                            $.ajax({
                                url: '/Material/GongYiHuiFU',
                                type: 'POST',
                                data: { "Bomid": Intid, "state": 4 },
								success: function (Aed) {
                                    console.log(Aed)
									for (var i = 1; i < Aed.length; i++) {
                                        $(".SJFtiajn").trigger('click')
                                    }
									var AIndex = 0
									$(".SJFtiajn").each(function (index, elecm) {
                                        $(elecm).parent().parent().children().eq(2).children().val(Aed[AIndex].Pric)
										$(elecm).parent().parent().children().eq(6).children().text(Aed[AIndex].JieH)
										$(elecm).parent().parent().children().eq(0).children().trigger('click')
                                        AIndex++
									})
                                },
                                error: function () {
                                    alert("系统错误");
                                }
                            })
                            sjifnn()
                            jsins()
                            hdhfjjjd()
                            hdufh()
						}
                    },
                    error: function () {
                        alert("系统错误");
                    }
                })
			}
			//新增辅料费
			function Add_table_row_accessory(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(`
										<tr>
											<td> <select style="width:100px;height:25px" id="CY_Gongf">
											<option value="">@Resource.String1117</option>
											<option value="">@Resource.String1118</option>
											<option value="">@Resource.String1119</option>
											<option value="">@Resource.String1120</option>
										</select></td>
											<td><input type="number" class="CY_jgf" style="width:100px;height:25px"placeholder="@Resource.String1121" min="0"/></td>
											<td><input type="number" class="CY_jgh" style="width:100px;height:25px" min="0" value="1"/></td>
											<td><input type="number" class="CY_GOF" style="width:100px;height:25px" min="0" value="0.1"/></td>
											<td><a href="#" id="CY_JGFH">@Resource.String1063</a></td>
										</tr>
									 `);
					e.parent().parent().parent().append($tr)
					Processing_cost()
				} else {
					e.parent().parent().remove()
					Processing_cost()
				}
			}

			//添加水印和表面处理
			function ZhenFan(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(`  <tr>
										<td>印刷</td>
										<td>
											<select>
												 <option value="1">@Resource.String1060</option>
												<option value="2">@Resource.String1061</option>
											</select>
										</td>
										<td>
											<select id="YS_GESHI" style="width:82px;" class="YS_GFESHI">
												<option value="">@Resource.String1051</option>
												@foreach (var item in ViewBag.Yinshua as List<libray>)
												{
													if (item.ST_ID == 1 && (item.LB_fne == "彩印印刷" || item.LB_fne == "一色印刷" || item.LB_fne == "二色印刷" || item.LB_fne == "三色印刷" || item.LB_fne == "满版印刷"))
													{
														<option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
													}
												}
											</select>
										</td>
										<td>
											<span></span>&nbsp;/@Resource.String1110/张
										</td>
										<td>
											@Resource.String1111：
											<input type="number" class="kokok">
										</td>
										<td>
											@Resource.String1114：
											<span class="YKO_ko"></span>
										</td>
										<td class="KOMMm" style="color:blue">@Resource.String1063</td>
									</tr>`)
					$("#SJINNS thead").append($tr)
					shundnko()
				} else {
					e.parent().remove()
					shundnko()
				}
				//添加到表格并改成删除

			}
			//添加正反面工艺--表面
			function Biaomiansji(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(`<tr>
										<td>@Resource.String1064</td>
										<td>
											<select>
												 <option value="1">@Resource.String1060</option>
												<option value="2">@Resource.String1061</option>
											</select>
										</td>
										<td>
											<select id="YS_GESHI" style="width:82px;" class="YS_GFESHI">
												<option value="">@Resource.String1051</option>
												@foreach (var item in ViewBag.Yinshua as List<libray>)
												{
													if (item.ST_ID == 2 && (item.LB_fne != "防水" && item.LB_fne != "防静电油墨" && item.LB_fne != "表面上油"))
													{
														<option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
													}
												}
											</select>
										</td>
										<td>
											<span></span>&nbsp;/㎡
										</td>
										<td></td>
										<td>
											@Resource.String1071：
											<span class="YKO_ko"></span>
										</td>
										<td class="LLPKKDD" style="color:blue">@Resource.String1063</td>
									</tr>`)
					$("#SJINNS>tbody").append($tr)
					shundnko()
				} else {
					e.parent().remove()
					shundnko()
				}
			}
		//添加正反面工艺--裱楞
            function BiaoLens(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(`<tr>
									<td>@Resource.String1106</td>
                                    <td style="width:15%">
                                    </td>
                                    <td>
                                        <select id="YS_GESHI" style="width:82px;" class="YS_GFESHI">
                                            <option value="">@Resource.String1051</option>
                                            @foreach (var item in ViewBag.Yinshua as List<libray>)
                                            {
                                                if (item.LB_fne == "裱楞")
                                                {
                                                    <option value="@item.LB_jia+@item.LB_ID">@item.LB_fne</option>
                                                }
                                            }
                                        </select>
                                    </td>
                                    <td>
                                        <span></span>&nbsp;/㎡
                                    </td>
                                    <td style="width:17%"></td>
                                    <td>
                                        @Resource.String1114：
                                        <span class="YKO_ko"></span>
                                    </td>
									<td class="BiaolenB" style="color: blue">添加</td>
                                </tr>`)
					$("#BiaojsnLm tbody").append($tr)
					shundnko()
				} else {
					e.parent().remove()
					shundnko()
				}
			}
			//添加上机费
			function Embarkation(e) {
				var caoz = e.text()
				if (caoz == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(` <tr>
							 <td style="width:30px;"><input type="radio" name="Weiyyi"style="width:30px;"  class="Jinhsu" /></td>
									<td style="width:260px;">@Resource.String1127：</td>
									<td><input type="number" value="0" class="KMsjnd" />/@Resource.String1128</td>
									<td style="display:none">@Resource.String1129</td>
									<td style="display:none"><input type="number" name="name" value="3000" class="Jieti" /></td>
									<td>损耗：<span></span></td>
									<td>@Resource.String796 <span class="Avgpris"></span></td>
									<td><span class="SJFtiajn">添加</span></td>
								</tr>`)
					e.parent().parent().parent().append($tr)
				} else {
					e.parent().parent().remove()
				}
			}
			//添加点击事件
			$(document).on("click", ".KOMMm", function(e) {
				ZhenFan($(e.target))
			})
			$(document).on("click", ".LLPKKDD", function(e) {
				Biaomiansji($(e.target))
			})
            $(document).on("click", ".BiaolenB", function (e) {
				BiaoLens($(e.target))
			})
			$(document).on("click", ".SJFtiajn", function(e) {
				Embarkation($(e.target))
			})

			function Processing_cost() {
				var sum = 0
				$(".CY_jgf").each(function(i, item) {
					var shufn = $(item).parent().next().children().val() * 1
					var shufneda = $(item).parent().next().next().children().val() * 1
					sum += $(item).val() * shufn + shufneda
				})
				$("#CYL_jgf").text(sum.toFixed(4))
				hdufh()
			}
			function Processing() {
				var sum = 0
				$(".CY_tingf").each(function(i, item) {
					var shufn = $(item).text() * 1
					sum += shufn
				})
				$("#okkosk").text(sum.toFixed(4))
				hdufh()
			}
			Find_Tear_and_ProcessingCharges()
			shujisuhdu()
			//显示单瓦楞和双瓦楞
			function WL() {
				var ds = $("#ZB_msed").val()

				var ds2 = ds.length
				var $tbody = $(`<tr>
										<td>@Resource.String1028</td>
										<td>
											<select class="ZB_CSed" style="width:120px;">
												<option>—@Resource.String72—</option>
											   @foreach (var item in ViewBag.ListPP as List<parice>)
												{
													if (@item.PA_Shuxing == 5 && @item.PA_LengBie.Contains("瓦"))
													{
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
											</select>
										</td>
										<td>
											<select class="ZB_KZed" style="width:300px;">
											</select>
										</td>
										<td></td>
										<td class="ZB_Unit_priced"></td>
									</tr>
									<tr>
										<td>@Resource.String1029</td>
										<td>
											<select class="ZB_CSed" style="width:120px;">
												<option>—@Resource.String72—</option>
											   @foreach (var item in ViewBag.ListPP as List<parice>)
												{
													if (@item.PA_Shuxing == 5)
													{
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
											</select>
										</td>
										<td>
											<select class="ZB_KZed"style="width:300px;">
											</select>
										</td>
										<td></td>
										<td class="ZB_Unit_priced"></td>
									</tr>`)
				var $tfoot = $(`
							<tr class="Shuangwa" id="Shuangwa1">
								<td>@Resource.String1028</td>
								<td>
									<select class="ZB_CSed" style="width:120px;">
										<option>—@Resource.String72—</option>
									   @foreach (var item in ViewBag.ListPP as List<parice>)
									   {
										   if (@item.PA_Shuxing == 5 && @item.PA_LengBie.Contains("瓦"))
										   {
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
									</select>
								</td>
								<td>
									<select class="ZB_KZed"style="width:3000px;">
									</select>
								</td>
								<td></td>
								<td class="ZB_Unit_priced"></td>
							</tr>

							<tr class="Shuangwa"  id="Shuangwa2" >
								<td>@Resource.String1212</td>
								<td>
									<select class="ZB_CSed" style="width:120px;">
										<option>—@Resource.String72—</option>
										@foreach (var item in ViewBag.ListPP as List<parice>)
												{
													if (@item.PA_Shuxing == 5)
													{
														<option value="@item.PA_LengBie">@item.PA_LengBie</option>
													}
												}
									</select>
								</td>
								<td>
									<select class="ZB_KZed" style="width:300px;">
									</select>
								</td>
								<td></td>
								<td class="ZB_Unit_priced"></td>
							</tr>
							`)
				if (ds == "N/A") {
					$("#ZB_ZC_tabled thead tr").remove()
					$("#ZB_ZC_tabled tbody tr").remove()
					$("#ZB_ZC_tabled tfoot tr").remove()
				} else {
					if (ds2 == "1") {
						$("#ZB_ZC_tabled tbody tr").remove()
						$("#ZB_ZC_tabled tfoot tr").remove()
						$("#ZB_ZC_tabled thead tr").remove()
						$("#KOJIG").val(1.30)
						$("#ZB_ZC_tabled tfoot").append($tfoot)

					} else if (ds2 == "2") {
						$("#ZB_ZC_tabled tbody tr").remove()
						$("#ZB_ZC_tabled tfoot tr").remove()
						$("#ZB_ZC_tabled thead tr").remove()
						$("#KOJIG").val(1.25)
						$("#ZB_ZC_tabled tbody").append($tbody)
						$("#ZB_ZC_tabled tfoot").append($tfoot)
					} else if (ds2 == "3") {
						$("#ZB_ZC_tabled tbody tr").remove()
						$("#ZB_ZC_tabled tfoot tr").remove()
						$("#ZB_ZC_tabled thead tr").remove()

						$("#ZB_ZC_tabled tbody").append($tbody)
						$("#ZB_ZC_tabled tbody").append($tbody)
						$("#ZB_ZC_tabled tfoot").append($tfoot)
					}
				}

			}
			//根据描述找到损耗,加工费和厚度
			function Find_Tear_and_ProcessingCharges() {
				var miaoshu = $("#ZB_msed").val()
				$.ajax({
					url: "/Procure/paperboard",
					type: 'GET',
					data: {
						"state": 2,
						"miaoshu": miaoshu
					},
					success: function(data) {
						$.each(data, function(i, item) {
							$("#ZB_jgfed").text(item.LB_jia)
							$("#ZB_shed").text(item.LB_shun)
							$("#ZB_HDed").text(item.LB_Zlei)
						})
						Sum_up()
					},
					error: function() {
						alert('Request Error');
					}
				})
			}
			//计算材料总价
			function Sum_up() {
				var dsji = $("#ZB_msed").val()
                var CYDm = $("#SyMbS").val()
				var temp = 0
                //console.log($("#SyMbS").prop("checked"), $("#IPsOKED").prop("checked"), $("#SyMbS").prop("checked") && $("#IPsOKED").prop("checked"))
                if ($("#SyMbS").prop("checked") && $("#IPsOKED").prop("checked")) {
                    temp = $("#MianZHI").text() * 1
                    //彩印费面纸的价格
				}
                $(".ZB_Unit_priced").each(function (i, item) {
                    temp = temp + $(item).text() * 1
                })//彩印费面纸的价格
				var sum = temp * 1 * (1 + $("#ZB_shed").text() * 0.01) + $("#ZB_jgfed").text() * 1//总价
				var sumji = temp * 1 * ($("#ZB_shed").text() * 0.01)//面纸的单价
				if (dsji == "1") {
					sum = 0;
				}
				$("#ZB_Total_priced").text((sum * 1).toFixed(4))
				$("#CY_Lenz").val(sum.toFixed(4))
				$("#jiahjoksed").text(sumji.toFixed(4))
				hdufh()
			}
			//计算长宽高
			function shujisuhdu() {
				var jind = $("#Lei_xined").val()
				var Leixing = $("#Chijisnn").val()
                var jNSS = $("input[name='CYJK']").val()*1//输入长
                var jNSS1 = $("input[name='CYJK1']").val()*1//输入框
                var jNSS2 = $("input[name='CYJK2']").val()*1//输入高
				var shufn = 0 //长
				var shufn1 = 0 //宽
				var shufn2 = 0 //高
				var qwed = $("#ZB_HDed").text() * 1
                if (jind == "4") {
                    Leixing == "1";
                }
                switch (Leixing) {
                    case "1"://内径尺寸
                        shufn = jNSS + qwed//长
                        shufn1 = jNSS1 + qwed //宽
                        switch (jind) {
                            case "1": shufn2 = jNSS2 + qwed//高
                                break; case "2": shufn2 = jNSS2 + qwed * 2//高
                                break; case "3": shufn2 = jNSS2 + qwed * 3//高
                                break;
                            default:
                        }
                        break;
                    case "2"://制造尺寸
                        shufn = jNSS  //长
                        shufn1 = jNSS1  //宽
                        shufn2 = jNSS2  //高
                        break;
                    case "3"://外径尺寸
                        shufn = jNSS - qwed//长
                        shufn1 = jNSS1 - qwed //宽
                        switch (jind) {
                            case "1": shufn2 = jNSS2 - qwed//高
                                break; case "2": shufn2 = jNSS2 - qwed * 2//高
                                break; case "3": shufn2 = jNSS2 - qwed * 3//高
                                break;
                            default:
                        }
                        break;
                    default:
                        break;
                }
                $('#CY_C').val(shufn);
                $('#CY_K').val(shufn1);
                $('#CY_G').val(shufn2);
                console.log(shufn, shufn1, shufn2)
				var Z_c = 2 * (shufn + shufn1) + 32 * 1 //计算展开长
				var Z_K=0;
				switch (jind) {
					case "1":
						$("#GUigesedse").show()
						Z_K = shufn2 + 0.5 * (shufn1 + qwed - 2)
						console.log(Z_K)
						break;
					case "2":
						$("#GUigesedse").show()
						Z_K = shufn2 + shufn1 + qwed - 2 * 1
						break;
					case "3":
						$("#GUigesedse").show()
						Z_K = 2 * shufn2 + shufn1
						break;
					case "4":
						$("#GUigesedse").show()
						Z_c = shufn1 * 2 + shufn2 * 3 + qwed * 6;
						Z_K = shufn * 1 + shufn2 * 4 + 18 * qwed;
						break;
					case "5":
						$("#GUigesedse").hide()
						Z_c = 0; //展开长
						Z_K = 0; //展开宽
						break;
					default:
						break;
				}
				var shukolp = Z_c * Z_K * qwed; //计算体积
				//var komlpp = Z_c * Z_K;
				$("#CY_ZKC").val(Z_c.toFixed(3))
				$("#CY_ZKK").val(Z_K.toFixed(3))
				$("#Tijiande").text((shukolp/1000000000).toFixed(4))
                sjifnn()
				hdhfjjjd()
			}

			function jishuna() {
				var DANJI = $("#KOLPSW").text()
				//计算工艺
				var Temp = 0;
				$(".CY_TY").each(function(i, item) {
					Temp = Temp + $(item).text() * 1
				})
				$("#WESH").text((DANJI * 1 + Temp * 1).toFixed(3))
			}

			function jsins() {
				var JIJ = $("#CY_tj").val() * 1 //吨价
				var JILP = $("#CY_kez").val() * 1 //克重
				var KOPWE = $("#ZB_Total_priced").text() * 1 //楞型单价
				var JINFD = JIJ / 1000000 * JILP + KOPWE
				$("#bancai").text(JINFD.toFixed(3))
			}
			//替换面纸单价
			function Product_p_ton() {
				var text = $("#SHUAN option:selected").val()
				if (text != null) {
					var parts = text.split("+"); // 使用逗号和空格作为分隔符
					let firstElement = parts[0];
					let lastElement = parts[parts.length - 1];
					$("#CY_xian tr").children().eq(5).children().first().val(firstElement)
					$("#CY_xian tr").children().eq(6).children().first().val(lastElement)
				}
			}
			//获取物料的标准成本
			function zblxdwss() {
				sjinfSC = ""
				var djisndlp = 0;
                var CYDJ = $("#SyMbS").val()
				$(".ZB_KZed").each(function(L, OJN) {
					djisndlp++;
					var skMPL = $(OJN).val()
					var skMPLDEW = $(OJN).parent().prev().prev().text()
					if ($("#SyMbS").prop("checked") && $(".lPsKO").prop("checked")) {
                        sjinfSC = ""
                        if (skMPL != null && djisndlp!=1) {
                            var LPMKO = skMPL.split("+")
                            var KMMM = LPMKO[LPMKO.length - 1]
                            if ($(".ZB_KZed").length == djisndlp) {
                                sjinfSC += KMMM
                            } else {
                                sjinfSC += KMMM + "*"
                            }
                        }
					} else {
                        if (skMPLDEW != "面纸") {
                            if (skMPL != null) {
                                var LPMKO = skMPL.split("+")
                                var KMMM = LPMKO[LPMKO.length - 1]
                                if ($(".ZB_KZed").length == djisndlp) {
                                    sjinfSC += KMMM
                                } else {
                                    sjinfSC += KMMM + "*"
                                }
                            }
                        }
					}
				})
				return sjinfSC;
			}
            $(document).on("change", ".ZB_KZed", function(e) {
                var jisnd = $("#ZB_msed").val();
				var sjinf = zblxdwss()
				console.log(sjinf)
				var husn=""
                if ($("#SyMbS").prop("checked") && $(".lPsKO").prop("checked")) {  } else {
                    husn = "彩盒纸板"
				}
				$.ajax({
					url: "/Material/APPoptiosjn",
					type: "POST",
					data: {
						"zbll": jisnd, //纸板楞型
						"ZBLx": sjinf, //纸板类型
						"stannd": 2,
                        "HSJIN": husn
					},
					success: function(s) {
						carkosedss(s)
					},
					error: function(s) {
						alert("系统错误!");
					}
				})
			})

			function carkosedss(s) {
				$("#seleect_de option").remove()
				$.each(s, function(re, item) {
                    var $TR = $(`<option value="${item[1]}">${item[0]},${item[2]},${item[1]}</option>`)
					$("#seleect_de").append($TR)
				})
				$("#seleect_de").parent().next().children().text($("#seleect_de").val())
                hdhfjjjd()
			}
			$(document).on("change", "#seleect_de", function() {
				$(this).parent().next().children().text($(this).val())
                hdhfjjjd()
			})
			$(document).on("change", "#SHUAN", function(x) {
				Product_p_ton()
				jsins()
				hdhfjjjd()
			})
			$(document).on("keyup", "#CY_ge,#CY_tj,#CY_kez,#CY_Lenz", function() {
				hdhfjjjd()
			})

			function heji() {
				var hjes = 0;
				$(".Avgpris").each(function(i, sh) {
					hjes += $(sh).text() * 1
					console.log(hjes * 1)
				})
				$(".Avgpri").text(hjes)
			}
			$(document).on("keyup", ".Jieti,.KMsjnd", function() {
				var AA = $("#CY_ge").val() * 1 //模数
				var AAC = $("#JCSCH_Pic").text() * 1 //价格
				var shunfk = $("#shugnd").text()
				var Shuji = $(this).parent().parent().children().eq(4).children().val() * 1 //阶梯价
				var V = $(this).parent().parent().children().eq(2).children().val() * 1 //实际张数
				Shuji = Shuji * AA //标准阶梯价
				$("#BZ_jieti").text(Shuji)
				if (V >= Shuji || V == 0) {
					$(this).parent().parent().children().eq(6).children().text(shunfk)
					$(".Avgpri").text(0)
				} else if (V < Shuji) {
					$(this).parent().parent().children().eq(6).children().text(((AAC / V) + shunfk * 1).toFixed(4))
					$(".Avgpri").text((AAC / V).toFixed(4))
				}
				hdufh()
				var sjindkom = $("#CY_shuan").text()*1
				var sjindkomI = $("#shugndwsq").text() * 1
				$(this).parent().parent().children().eq(5).children().text((sjindkom).toFixed(5))
				$(this).parent().parent().children().eq(6).children().text((sjindkomI).toFixed(5))
			})
			$(document).on("click", ".Jinhsu", function () {
                var AA = $("#CY_ge").val() * 1 //模数
                var AAC = $("#JCSCH_Pic").text() * 1 //价格
                var Shuji = $(this).parent().parent().children().eq(4).children().val() * 1 //阶梯价
				var V = $(this).parent().parent().children().eq(2).children().val() * 1 //实际张数
                Shuji = Shuji * AA //标准阶梯价
                $("#BZ_jieti").text(Shuji)
				//$("#shugndwsq").text($(this).parent().parent().children().eq(5).children().text())
                if (V >= Shuji || V == 0) {
                    $(".Avgpri").text(0)
                } else if (V < Shuji) {
                    $(".Avgpri").text((AAC / V).toFixed(4))
				}
                hdufh()
            })
			$(document).on("click", "#shidjdi", function() {
				hdufh()
			})
			$(document).on("change", "#CY_GFDW", function() {
				var HUJJFN = $(this).val()
				var SJIN = $("#CJINDS").text() / 1000
				$(this).parent().next().text(HUJJFN)
				$(this).parent().next().next().text(HUJJFN * SJIN)
				jishuna()
			})
			$(document).on("keyup", "#CY_tj,#CY_kez", function() {
				jsins()
			})
			$(document).on("keyup", "#CAIDKO", function() {
				$("#CY_Lenz").val($(this).val())
				hdhfjjjd()
			})

			//+1
			$(document).on("click", ".lPsKO", function() {
				var $theat = $(`<tr>
								<td>@Resource.String1027</td>
								<td>
									<select class="ZB_CSed" style="width:120px;">
										<option>—@Resource.String72—</option>
										@foreach (var item in ViewBag.ListPP as List<parice>)
										{
											if (@item.PA_Shuxing == 5)
											{
												<option value="@item.PA_LengBie">@item.PA_LengBie</option>
											}
										}
									</select>
								</td>
								<td>
									<select class="ZB_KZed" style="width:300px;">
									</select>
								</td>
								<td></td>
								<td class="ZB_Minazhi_Price"  id="MianZHI"></td>
							</tr>`)
				if ($(".lPsKO").prop("checked")) {
					$("#ZB_ZC_tabled thead").append($theat)
				} else {
					$("#ZB_ZC_tabled thead tr").remove()
				}
			})

			$(document).on("change", "#YS_GESHIwds", function () {
				var shundd = $(this).val().split("+")[0]
				$(this).parent().next().children().text(shundd)
				var sjinf = $("#CY_C").val() * 1 //长度
				var sjinf = $("#CY_K").val() * 1 //宽度
				var jisn = (sjinf + sjinf) / 1000 * shundd
				$(this).parent().next().next().next().children().text(jisn.toFixed(4))
				shundnko()
			})
			$(document).on("keyup", "#yihj", function() {
				jishuna()
			})
			$(document).on("change", ".CY_TY", function() {
				jishuna()
			})
			$(document).on("change", "#YS_GESHI", function() {
				var JIDE = $(this).val().split('+')[0] * 1
				var MOshus = $("#CY_ge").val() * 1//模数
				$(this).parent().next().children().text(JIDE) //价格
				var SUN = $("#CY_xian tr td:nth-child(9)").text() * 1
                console.log(JIDE,(JIDE * SUN).toFixed(4))
				var sjimkko = this.options[this.selectedIndex].text;
				var Biaoti = $(this).parent().parent().children().eq(0).text();
                if (Biaoti == "印刷" && sjimkko == "彩印印刷") {
                    $(this).parent().next().replaceWith("<td><span>" + JIDE +"</span>&nbsp;/@Resource.String1110/张</td>")
                } else if (Biaoti == "印刷" && sjimkko != "彩印印刷") {
                    $(this).parent().next().replaceWith("<td><span>" + JIDE +"</span>/㎡</td>")
                }
				if (sjimkko == "彩印印刷") {
                    $(this).parent().next().next().children().css({ "display": "block" })
					var JINFJD = $(this).parent().next().next().children().val() //yanse
					if (JINFJD > 4) {
						var JJIII = JINFJD * 1 - 4 * 1;
						var MKJI = JJIII * 2 + 4 * 1;
                        $(this).parent().next().next().next().children().text((JIDE * MKJI / MOshus).toFixed(4))
					} else if (JINFJD > 1 && JINFJD < 4) {
                        $(this).parent().next().next().next().children().text((JIDE * MKJI / MOshus).toFixed(4))
					} else if (JINFJD == "") {
						$(this).parent().next().next().next().children().text(0)
					}
				} else {
					$(this).parent().next().next().children().css({ "display": "none" })
					$(this).parent().next().next().next().children().text((JIDE * SUN).toFixed(4))
				}
				if (sjimkko == "局部UV" || sjimkko == "烫金" || sjimkko == "烫银") {
					$(this).parent().next().replaceWith("<td><span></span>/@Resource.String1128</td>")
					$(this).parent().next().children().text(JIDE)
					$(this).parent().next().next().next().children().text((JIDE / MOshus).toFixed(4))
				}
                if (sjimkko == "水性油" || sjimkko == "表面覆膜" || sjimkko == "吸塑油" || sjimkko == "UV油" || sjimkko == "丝印") {
					$(this).parent().next().replaceWith("<td><span></span>/㎡</td>")
					$(this).parent().next().children().text(JIDE)
					$(this).parent().next().next().next().children().text((JIDE * SUN / MOshus).toFixed(4))
				}
				shundnko()
			})
			$(document).on("keyup", ".kokok", function () {
                var MOshus = $("#CY_ge").val() * 1//模数
				var Z_c = $("#CY_ZKC").val() * 1
				var Z_K = $("#CY_ZKK").val() * 1
				var JINFJD = $(this).val() //yanse
				var jinsf = $(this).parent().prev().children().text()//价格
				if (JINFJD > 8) {
					$(this).val(8)
                    var KOMG = jinsf * 12 / MOshus;
					$(this).parent().next().children().text(KOMG.toFixed(4))
				} else if (JINFJD > 4) {
					var JJIII = JINFJD * 1 - 4 * 1;
					var MKJI = JJIII * 2 + 4 * 1;
                    var sjinnmlp = jinsf * MKJI / MOshus;
					$(this).parent().next().children().text(sjinnmlp.toFixed(4))
				} else if (JINFJD >= 1 && JINFJD <= 4) {
                    var sjmlp = jinsf * 4 / MOshus;
					$(this).parent().next().children().text(sjmlp.toFixed(4))
				} else if (JINFJD == "") {
					$(this).parent().next().children().text(0)
				}
				shundnko()
			})
			shundnko()

			function shundnko() {
				var temp = 0;
				$(".YKO_ko").each(function(i, item) {
					temp += $(item).text() * 1
				})
				$("#CYst").text(temp.toFixed(4))
			}
			//计算展开长宽
			$(document).on("keyup", ".zhnagkaied", function() {
				shujisuhdu()
				jishuna()
				jsins()
				hdufh()
			})
			$(document).on("keyup", "#yihj", function() {
				var Z_c = $("#CY_ZKC").val()
				var Z_K = $("#CY_ZKK").val()
				var B = $(this).val()
				var CDE = $("#bancai").text() * 1
				//$("#CJINDS").text(Z_c * 1 + 20)
				//$("#KJINDS").text((Z_K * B) + 15)
				var shunf = (Z_c * 1 + 20) * (Z_K * B + 15)
				$("#mianjirf").text((shunf / 1000000).toFixed(4))
				$("#KOLPSW").text((shunf / 1000000 / B * CDE).toFixed(4))
				jishuna()
			})
			$(document).on("keyup", "#CY_ZKC,#CY_ZKK", function() {
				var Ajins = $("#CY_ZKC").val() * 1//长
				var Ajinsws = $("#CY_ZKK").val() * 1//宽
				var qwed = $("#ZB_HDed").text() * 1
                sjifnn()
				$("#Tijiande").text((Ajins * Ajinsws * qwed/1000000000).toFixed(4))
				hdhfjjjd()
				jsins()
				hdufh()
			})
			$(document).on("change", "#Lei_xined,#ZB_msed", function() {
				shujisuhdu()
				hdufh()
			})
			//添加材料
			$(document).on("change", ".ZB_CSed,.ZB_KZed", function() {
				//Product_p_ton()
				Sum_up()
				jsins()
			})

			//贴双面胶
			$(document).on("change", "#CY_tingf", function(e) {
				var shudf = $(e.target).val() * 1 //价格
				var jisn = 0;
				var NY = shudf > 0 ? 1 : 0;
				$(e.target).parent().next().children().text(shudf)
				var shungf = $("#shufn_s").val() * 1 //米数
				var sjilp = $(e.target).parent().next().next().children().val() * 1
                var sjilpeds = $(e.target).parent().next().next().next().children().val() * 1
                jisn = (shungf * (shudf + sjilp) * NY) * sjilpeds//单价
				$(e.target).parent().parent().children().eq(4).text(jisn.toFixed(4))
				Processing()
			})
            $(document).on("keyup",".JINDDD",function () {
				var sum = 0
                var shungf = $("#shufn_s").val() * 1 //米数
				$(".CY_tingf").each(function (i, item) {
					var A = $(item).parent().children().eq(1).children().text() * 1//单价
					var B = $(item).parent().children().eq(2).children().val() * 1//加工费
                    B = A == 0 ? 0 : B;
					var C = $(item).parent().children().eq(3).children().val()*1//数量
					var shufn = (A + B) * C * shungf
					console.log(A, B, C, shufn)
					$(item).text(shufn.toFixed(4))
                    sum += shufn
                })
                $("#okkosk").text(sum.toFixed(4))
                hdufh()
			})
			$(document).on("keyup", "#shufn_s", function(e) {
				var shudf = $(e.target).val()
				$(e.target).parent().next().text(shudf)
				Processing()
			})

			//辅料
			$(document).on("click", "#CY_JGFH", function(e) {
				Add_table_row_accessory($(e.target))
			})
			$(document).on("keyup", ".CY_jgf,.CY_jgh,.CY_GOF", function() {
				Processing_cost()
			})

			//结合+包装
			function dhdhss() {
				var hhsss = $("#CY_baozs").text()
				var djjdf = $("#CY_jiehea").text()
				var shfnf = djjdf * 1 + hhsss * 1
				$("#CYY_jsijn").text(shfnf.toFixed(4))
				hdufh()
			}

			//推荐机型
			function sjifnn() {
				var ZKC = $("#CY_ZKC").val()
				var ZKK = $("#CY_ZKK").val()
				var he = 0//模数
				var change = 0
				var kuan = 0;
				var changbainM =0
				var kuanbianM = 0
				var selectedOption = 0;
                var select2 = document.getElementById("shundijk");
				for (var i = 0; i < select2.options.length; i++) {
					console.log(he,i)
                    if (he>=1) {
						continue
                    }
                    var [c, k, price] = select2.options[i].value.split('*').map(Number);
                    //长多长 ，宽对宽
                    var l1 = Math.floor((c * 1 - 20 * 1) / ZKC) >= 1 ? Math.floor((c * 1 - 20 * 1) / ZKC) : 0
                    var l2 = Math.floor((k * 1 - 20 * 1) / ZKK) >= 1 ? Math.floor((k * 1 - 20 * 1) / ZKK) : 0
                    //长对宽
                    var S1 = Math.floor((c * 1 - 20 * 1) / ZKK) >= 1 ? Math.floor((c * 1 - 20 * 1) / ZKK) : 0
                    var S2 = Math.floor((k * 1 - 20 * 1) / ZKC) >= 1 ? Math.floor((k * 1 - 20 * 1) / ZKC) : 0
                    console.log(l1, l2, S1, S2)//3 1 1 2
                    if ((l1 * l2) <= 1) {
                        if ((S1 * S2) == 0) {
                            if ((l1 * l2) == 1) {
                                he = 1
                                change = ZKC
                                kuan = ZKK
                                changbainM = l1
								kuanbianM = l2
								selectedOption = i;
								console.log(223)
                            }
                        } else {
                            if ((S1 * S2) >= he && (S1 * S2) >= 1) {
                                he = S1 * S2
                                change = ZKK
                                kuan = ZKC
                                changbainM = S1
								kuanbianM = S2
								selectedOption = i;
                                console.log(2234)
                            }
                        }
                    } else if ((S1 * S2) <= 1) {
                        if ((l1 * l2) <= 1) {
                            if ((S1 * S2) == 1) {
                                he = 1
                                change = ZKK
                                kuan = ZKC
                                changbainM = S1
								kuanbianM = S2
								selectedOption = i;
                                console.log(2235)
                            }
                        } else {
                            if ((l1 * l2) >= he && (l1 * l2) >= 1) {
                                he = l1 * l2
                                change = ZKC
                                kuan = ZKK
                                changbainM = l1
								kuanbianM = l2
								selectedOption = i;
                                console.log(2236)
                            }
                        }
                    } else if ((l1 * l2) <= (S1 * S2)) {
                        if ((S1 * S2) >= he && (S1 * S2) >= 1) {
                            he = S1 * S2
                            change = ZKK
                            kuan = ZKC
                            changbainM = S1
                            kuanbianM = S2
							selectedOption = i;
                            console.log(2237)
                        }
                    } else if ((l1 * l2) > (S1 * S2)) {
                        if ((l1 * l2) >= he && (l1 * l2) >= 1) {
                            he = l1 * l2
                            change = ZKC
                            kuan = ZKK
                            changbainM = l1
                            kuanbianM = l2
							selectedOption = i;
                            console.log(2238)
                        }
                    }
				}
				console.log(he, change, kuan, changbainM, kuanbianM, selectedOption)
				select2.options[selectedOption].selected = true;
				var [a, b, D] = select2.options[selectedOption].value.split('*').map(Number);
				$("#JCSCH_K").text(b)
				$("#JCSCH_C").text(a)
                $("#JCSCH_Pic").text(D)
                if (he >= 1) {
                    if (changbainM >= 1 && kuanbianM >= 1) {
                        he = Math.floor(he)
                        $("#JCSCH_cd").text(he)
						$("#CY_ge").val(he)
					} else {
                        change = ZKC
						kuan = ZKK
						he = 1
                        changbainM = 1
                        kuanbianM = 1
                        $("#CY_ge").val(1)
                        $("#JCSCH_cd").text("该机床不合适！")
                    }
				} else {
                    change = ZKC
					kuan = ZKK
					he = 1
                    changbainM = 1
                    kuanbianM = 1
                    $("#JCSCH_cd").text("该机床不合适！")
                    $("#CY_ge").val(1)
				}
                //门幅 +20
                var ieds = 0;
                do {
                    ieds++;
                } while (ieds * 50 < change * changbainM * 1 + 20);
                $("#CY_xian tr td:nth-child(1)").text(change * changbainM * 1 + 20)
                $("#CY_xian tr td:nth-child(2)").text(ieds * 50)
                $("#CY_xian tr td:nth-child(3)").text(kuan * kuanbianM* 1 + 20)
                hdhfjjjd()
                Averageprice()
			}
			$(document).on("change", "#shundijk", function () {
                var ZKC = $("#CY_ZKC").val()
                var ZKK = $("#CY_ZKK").val()
				var shinfwe = $(this).val()
				var shinfed = shinfwe.split("*")
                var he = 0//模数
                var change = 0
                var kuan = 0;
                var changbainM = 0
                var kuanbianM = 0
                var c = shinfed[0] * 1-20//机床长
                var k = shinfed[1] * 1-20//机床宽
                var  pric = shinfed[2] * 1//机床的价格ss
                $("#JCSCH_K").text(k+20)
                $("#JCSCH_C").text(c+20)
				$("#JCSCH_Pic").text(pric)
                console.log("机床长",c,"机床宽",k)
                //长多长 ，宽对宽
                var l1 = Math.floor(c / ZKC) >= 1 ? Math.floor(c / ZKC) : 0
                var l2 = Math.floor(k / ZKK) >= 1 ? Math.floor(k / ZKK) : 0
                //长对宽
                var S1 = Math.floor(c / ZKK) >= 1 ? Math.floor(c / ZKK) : 0
                var S2 = Math.floor(k / ZKC) >= 1 ? Math.floor(k / ZKC) : 0
				if ((l1 * l2) <= 1) {
					if ((S1 * S2) == 0) {
                        if ((l1 * l2) == 1) {
                            he = 1
                            change = ZKC
                            kuan = ZKK
                            changbainM = l1
                            kuanbianM = l2
                        }
					} else {
						if ((S1 * S2) >= he && (S1 * S2) >= 1) {
							he = S1 * S2
							change = ZKK
							kuan = ZKC
							changbainM = S1
							kuanbianM = S2
						}
					}
				} else if ((S1 * S2) <= 1) {
					if ((l1 * l2) <= 1) {
                        if ((S1 * S2) ==1) {
                            he = 1
                            change = ZKK
                            kuan = ZKC
                            changbainM = S1
                            kuanbianM = S2
                        }
					} else {
						if ((l1 * l2) >= he && (l1 * l2) >= 1) {
							he = l1 * l2
							change = ZKC
							kuan = ZKK
							changbainM = l1
							kuanbianM = l2
						}
					}
				} else if ((l1 * l2) <= (S1 * S2)) {
					if ((S1 * S2) >= he && (S1 * S2) >= 1) {
						he = S1 * S2
						change = ZKK
						kuan = ZKC
						changbainM = S1
						kuanbianM = S2
					}
				} else {
					if ((l1 * l2) >= he && (l1 * l2) >= 1) {
						he = l1 * l2
						change = ZKC
						kuan = ZKK
						changbainM = l1
						kuanbianM = l2
					}
				}
                console.log("he:", he, l1, l2, S1, S2, change, kuan);
                if (he >= 1) {
                    if (changbainM >= 1 && kuanbianM >= 1) {
                        he = Math.floor(he)
                        $("#JCSCH_cd").text(he)
                        $("#CY_ge").val(he)
					} else {
						he = 1
                        change = ZKC
						kuan = ZKK
                        changbainM = 1
                        kuanbianM = 1
                        $("#CY_ge").val(1)
                        $("#JCSCH_cd").text("该机床不合适！")
                    }
				} else {
                    change = ZKC
                    kuan = ZKK
					he = 1
                    changbainM = 1
                    kuanbianM = 1
                    $("#JCSCH_cd").text("该机床不合适！")
                    $("#CY_ge").val(1)
				}
                //门幅 +20
                var ieds = 0;
                do {
                    ieds++;
                } while (ieds * 50 < change * changbainM * 1 + 20);
                $("#CY_xian tr td:nth-child(1)").text(change * changbainM * 1 + 20)
                $("#CY_xian tr td:nth-child(2)").text(ieds * 50)
                $("#CY_xian tr td:nth-child(3)").text(kuan * kuanbianM * 1 + 20)
                console.log(change * he + 20, ieds * 50, kuan * 1 + 20)
                hdhfjjjd()
                Averageprice()
			})
			$(document).on("change", "#CY_jiehe", function(e) {
				var K = $("#CY_K").val()
				var G = $("#CY_G").val()
				var shudf = $(e.target).val()
				$(e.target).parent().next().text(shudf)
				var zhongs = (K * 1 + G * 1) / 1000 * shudf
				$("#CY_jiehea").text(zhongs)
				dhdhss()
			})
			$(document).on("change", "#CY_baoz", function() {
				var K = $("#CY_xian tr td:nth-child(9)").text() * 1
				var shudf = $(this).val()
				if (shudf == "S") {
                    $(this).parent().next().text("")
                    $(this).parent().next().append(`价格:<input type="text" id="shiyongC" value=""/>元 &nbsp; 数量<input type="text" id="shiyongB" value=""/>/个`)
				} else {
                    $(this).parent().next().text("")
                    $(this).parent().next().append(`<span></span>元/㎡`)
                    shudf = shudf*1
                    $(this).parent().next().children().text(shudf)
                    var zhongs = K * shudf
                    $(this).parent().next().next().text(zhongs.toFixed(4))
                    dhdhss()
				}
			})
            $(document).on("keyup", "#shiyongC", function () {
                sHUs()
			})
			function sHUs() {
				var K = $("#shiyongC").val() * 1
                var SD = $("#shiyongB").val() * 1
                var Jshu = (K / SD);
                Jshu = K == "" || SD == "" ? 0 : Jshu;
                $("#shiyongC").parent().next().text(Jshu.toFixed(4))
                dhdhss()
			}
			//改变描述下拉框触发事件
			$(document).on("change", "#ZB_msed", function() {
				WL()
				Find_Tear_and_ProcessingCharges()
				Sum_up()
			})
		})
		function Get_AuxiliaryMaterialsCost(e) {
			var gy = e.val().split("+")
            var gyf = gy[0]
            if (gyf != null) {
                var fl = $("#SL_WLFL").val()
                if (fl == "胶带") {
                    var jia = gyf * 1
                    var MJ = $("#SL_MJ").val() * 1
                    e.parent().next().text((jia * MJ).toFixed(6))
                } else {
                    var jia = gyf * 1
                    console.log(jia)
                    var shj = $("#SL_SJZL").val() * 1
                    console.log(shj)
                    e.parent().next().text((jia * shj).toFixed(6))
                }
            }
        }
		function spec() {
			var fl = $("#SL_WLFL").val()
			var index = 1
			if (fl == "缓冲材") {
				$("#div1").css({
					"display": "none"
				})
				$("#div2").css({
					"display": "block"
				})
				$("#SL_SLD_ZL_td").remove()
			} else {
				$("#div1").css({
					"display": "block"
				})
				$("#div2").css({
					"display": "none"
				})
				if (fl == "塑料袋") {
					$("#SL_SLD_ZL_td").remove()
					var $td = $(`
										<td id="SL_SLD_ZL_td">
											<select id="SL_SLD_zl">
												<option value="0">-@Resource.String72-</option>
												<option value="1">@Resource.String1214</option>
												<option value="2">@Resource.String1215</option>
												<option value="3">@Resource.String1216</option>
												<option value="4">@Resource.String1217</option>
												<option value="5">@Resource.String1218</option>
											</select>
										</td>
										`)
					$("#SL_WLFL").parent().parent().append($td)
				} else if (fl == "气泡袋") {
					$("#SL_SLD_ZL_td").remove()
					$("#SL_GG tr").remove()
					var $tr = $(`
										 <tr>
											 <td>@Resource.String1016</td>
											 <td><input type="number" class="inp" id="SL_C" /></td>
											 <td>@Resource.String1017</td>
											 <td><input type="number" class="inp" id="SL_K" /></td>
											 <td>@Resource.String1219</td>
											 <td><input type="number" class="inp" id="SL_MJ" /></td>
										 </tr>
										 <tr>
											 <td>@Resource.String1220</td>
											 <td><input type="number" class="inp" id="SL_G" /></td>
											 <td>@Resource.String1221</td>
											 <td><input type="number" class="inp" id="SL_SJZL" /></td>
										 </tr>
										 `)
					$("#SL_GG").append($tr)
				} else if (fl == "胶带") {
					$("#SL_SLD_ZL_td").remove()
					$("#SL_GG tr").remove()
					var $tr = $(`
										 <tr>
											 <td>@Resource.String805</td>
											 <td><input type="number" class="inp" id="SL_C" /></td>
											 <td>@Resource.String1017</td>
											 <td><input type="number" class="inp" id="SL_K" /></td>
											 <td>@Resource.String1219</td>
											 <td><input type="number" class="inp" id="SL_MJ" /></td>
										 </tr>
										 <tr>
											 <td>@Resource.String1169</td>
											 <td><input type="number" class="inp" id="SL_H" value="50"/></td>
											 <td>@Resource.String1189</td>
											 <td><input type="number" class="inp" id="SL_M"  value="0.91"/></td>
											 <td>@Resource.String1221</td>
											 <td><input type="number" class="inp" id="SL_SJZL" /></td>
										 </tr>
										 `)
					$("#SL_GG").append($tr)
				} else if (fl == "吸塑") {
					$("#SL_SLD_ZL_td").remove()
					$("#SL_GG tr").remove()
					var $tr = $(`
										 <tr>
											<td>@Resource.String1172</td>
											<td><input type="number" class="inp" id="SL_SJZL" /></td>
										 </tr>
										 `)
					$("#SL_GG").append($tr)
				} else if (fl == "铝箔") {
                    $("#SL_SLD_ZL_td").remove()
					var $td = $(`
								<td id="SL_SLD_ZL_td">
									<select id="SL_SLD_zl">
										<option value="0">-@Resource.String72-</option>
										<option value="1">@Resource.String810</option>
										<option value="2">@Resource.String811</option>
										<option value="3">@Resource.String812</option>
										<option value="4">@Resource.String813</option>
									</select>
								</td>
								`)
					$("#SL_WLFL").parent().parent().append($td)
                }else  {
					$("#SL_SLD_ZL_td").remove()
					$("#SL_GG tr").remove()
					var $tr = $(`
										<tr>
											<td>@Resource.String1016</td>
											<td><input type="number" class="inp" id="SL_C" /></td>
											<td>@Resource.String1017</td>
											<td><input type="number" class="inp" id="SL_K" /></td>
											<td>@Resource.String1169</td>
											<td><input type="number" class="inp" id="SL_H" /></td>
										</tr>
										<tr>
											<td>@Resource.String1170</td>
											<td><input type="number" value="0.92" class="inp" id="SL_M"/></td>
											<td>@Resource.String1171</td>
											<td><input type="number" class="inp" id="SL_LLJZ" /></td>
											<td>@Resource.String1172</td>
											<td><input type="number" class="inp" id="SL_SJZL" /></td>
										</tr>
										`)
					$("#SL_GG").append($tr)
				}
			}
		}

		function AuxiliaryPanel() {
			var fl = $("#SL_WLFL").val()
			if (fl == "吸塑" || fl == "缓冲材" || fl == "塑料袋" || fl == "气泡袋") {
				$("#SL_FLMB").css({
					"display": "none"
				})
				$("#SL_FLFXJ").text(0)
			} else {
				$("#SL_FLMB").css({
					"display": "block"
				})
			}
			if (fl == "气泡袋") {
				$("#MKJRTY").css({
					"display": "block"
				})
			} else {
				$("#MKJRTY").css({
					"display": "none"
				})
			}
			if (fl == "吸塑") {
				$("#SL_JGF_2").css({
					"display": "block"
				})
                $("#SL_JGF_1,#SL_JGF_3,#SL_JGF_4").css({
					"display": "none"
				})
            } else if (fl == "铝箔") {
                $("#SL_JGF_2,#SL_JGF_1,#ZHIT").css({
                    "display": "none"
				})
                $("#SL_JGF_3,#SL_JGF_4").css({
                    "display": "block"
                })
			} else {
                $("#SL_JGF_2,#SL_JGF_3,#SL_JGF_4").css({
					"display": "none"
				})
				$("#SL_JGF_1").css({
					"display": "block"
				})
			}
		}
		function BlisterProcessFlow() {
			var fl = $("#SL_WLFL").val()
			if (fl == "吸塑") {
				$.ajax({
					url: "/Procure/Plastic_product",
					type: 'GET',
					data: {
						"state": 7
					},
					success: function(data) {
						$("#SL_JGF_2 tbody tr").remove()
						$.each(data, function(i, obj) {
							if (obj.LB_fne != "冲切") {
								var $tr = $(`
										<tr>
											<td><input type="checkbox" checked="checked" /></td>
											<td>${obj.LB_fne}</td>
											<td>${obj.LB_jia}</td>
											<td><span>${obj.LB_shun}</span>%</td>
										</tr>
										`)
								$("#SL_JGF_2 tbody").append($tr)
							} else {
								var $tr = $(`
										<tr>
											<td><input type="checkbox" id="Xs_cq" /></td>
											<td>${obj.LB_fne}</td>
											<td>${obj.LB_jia}</td>
											<td><span>${obj.LB_shun}</span>%</td>
										</tr>
										`)
								$("#SL_JGF_2 tbody").append($tr)
							}
						})
					},
					error: function() {
						alert('Request Error');
					}
				})
			}
		}
		//切换塑料袋显示
		function PlasticBagClassification() {
			var fl = $("#SL_WLFL").val()
			var sld = $("#SL_SLD_zl").val()
			console.log(fl,sld)
			if (fl == "塑料袋") {
				if (sld == "1" || sld == "2" || sld == "5") {
					$("#SL_GG tr").remove()
					var $tr = $(`
										<tr>
											<td>@Resource.String1016</td>
											<td><input type="number" class="inp" id="SL_C" /></td>
											<td>@Resource.String1017</td>
											<td><input type="number" class="inp" id="SL_K" /></td>
											<td>@Resource.String1169</td>
											<td><input type="number" class="inp" id="SL_H" /></td>
											<td>@Resource.String1170</td>
											<td><input type="number" value="0.92" class="inp" id="SL_M" /></td>
										</tr>
										<tr>
											<td>@Resource.String1219</td>
											<td><input type="number" class="inp" id="SL_MJ" /></td>
											<td>@Resource.String1171</td>
											<td><input type="number" class="inp" id="SL_LLJZ" /></td>
											<td>@Resource.String1172</td>
											<td><input type="number" class="inp" id="SL_SJZL" /></td>
										</tr>
										`)
					$("#SL_GG").append($tr)
				} else if (sld == "3") {
					$("#SL_GG tr").remove()
					var $tr = $(`
								<tr>
									<td>@Resource.String1016</td>
									<td><input type="number" class="inp" id="SL_C" /></td>
									<td>@Resource.String1017</td>
									<td><input type="number" class="inp" id="SL_K" /></td>
									<td>@Resource.String1018</td>
									<td><input type="number" class="inp" id="SL_G" /></td>
									<td>@Resource.String1169</td>
									<td><input type="number" class="inp" id="SL_H" /></td>
								</tr>
								<tr>
									<td>@Resource.String1170</td>
									<td><input type="number" value="0.92" class="inp" id="SL_M" /></td>
									<td>@Resource.String1219</td>
									<td><input type="number" class="inp" id="SL_MJ" /></td>
									<td>@Resource.String1171</td>
									<td><input type="number" class="inp" id="SL_LLJZ" /></td>
									<td>@Resource.String1172</td>
									<td><input type="number" class="inp" id="SL_SJZL" /></td>
								</tr>
								`)
					$("#SL_GG").append($tr)
				} else {
					$("#SL_GG tr").remove()
					var $tr = $(`
								<tr>
									<td>@Resource.String1223</td>
									<td><input type="number" class="inp" id="SL_C" /></td>
									<td>@Resource.String1224</td>
									<td><input type="number" class="inp" id="SL_K" /></td>
									<td>@Resource.String1225</td>
									<td><input type="number" class="inp" id="SL_G" /></td>
									<td>@Resource.String1169</td>
									<td><input type="number" class="inp" id="SL_H" /></td>
								</tr>
								<tr>
									<td>@Resource.String1170</td>
									<td><input type="number" value="0.92" class="inp" id="SL_M" /></td>
									<td>@Resource.String1219</td>
									<td><input type="number" class="inp" id="SL_MJ" /></td>
									<td>@Resource.String1171</td>
									<td><input type="number" class="inp" id="SL_LLJZ" /></td>
									<td>@Resource.String1172</td>
									<td><input type="number" class="inp" id="SL_SJZL" /></td>
								</tr>
								`)
					$("#SL_GG").append($tr)
				}
			}
			if (fl == "铝箔") {
				if (sld == "1" || sld == "2") {
					$("#SL_GG tr").remove()
					var Chang = "";
					var Kuan = "";
					if (sld == "1") {
						Chang ="@Resource.String805";
						Kuan ="@Resource.String1017";
                    } else {
						Chang ="@Resource.String814";
						Kuan ="@Resource.String815";
					}
					var $tr = $(`
								<tr>
									<td>${Chang}</td>
									<td><input type="number" class="inp" id="SL_C" /></td>
									<td>${Kuan}</td>
									<td><input type="number" class="inp" id="SL_K" /></td>
									<td>@Resource.String1169</td>
									<td><input type="number" class="inp" id="SL_H" /></td>
									<td>平方重量g/m²</td>
									<td><input type="number" value="" class="inp" id="SL_M" /></td>
								</tr>
								<tr>
									<td>@Resource.String1219</td>
									<td><input type="number" class="inp" id="SL_MJ" /></td>
									<td>理论重量G</td>
									<td><input type="number" class="inp" id="SL_LLJZ" /></td>
									<td>实际重量G</td>
									<td><input type="number" class="inp" id="SL_SJZL" /></td>
								</tr>
								`)
							$("#SL_GG").append($tr)
				} else if (sld == "3") {
								$("#SL_GG tr").remove()
					var $tr = $(`
								<tr>
									<td>@Resource.String814</td>
									<td><input type="number" class="inp" id="SL_C" /></td>
									<td>@Resource.String815</td>
									<td><input type="number" class="inp" id="SL_K" /></td>
									<td>@Resource.String816</td>
									<td><input type="number" class="inp" id="SL_G" /></td>
									<td>@Resource.String1169</td>
									<td><input type="number" class="inp" id="SL_H" /></td>
								</tr>
								<tr>
									<td>平方重量g/m²</td>
									<td><input type="number" value="" class="inp" id="SL_M" /></td>
									<td>@Resource.String1219</td>
									<td><input type="number" class="inp" id="SL_MJ" /></td>
									<td>理论重量G</td>
									<td><input type="number" class="inp" id="SL_LLJZ" /></td>
									<td>实际重量G</td>
									<td><input type="number" class="inp" id="SL_SJZL" /></td>
								</tr>
								`)
					$("#SL_GG").append($tr)
				} else {
					$("#SL_GG tr").remove()
						var $tr = $(`
									<tr>
										<td>@Resource.String1223</td>
										<td><input type="number" class="inp" id="SL_C" /></td>
										<td>@Resource.String1224</td>
										<td><input type="number" class="inp" id="SL_K" /></td>
										<td>@Resource.String1225</td>
										<td><input type="number" class="inp" id="SL_G" /></td>
										<td>@Resource.String1169</td>
										<td><input type="number" class="inp" id="SL_H" /></td>
									</tr>
									<tr>
										<td>平方重量g/m²</td>
										<td><input type="number" value="" class="inp" id="SL_M" /></td>
										<td>@Resource.String1219</td>
										<td><input type="number" class="inp" id="SL_MJ" /></td>
										<td>理论重量G</td>
										<td><input type="number" class="inp" id="SL_LLJZ" /></td>
										<td>实际重量G</td>
										<td><input type="number" class="inp" id="SL_SJZL" /></td>
									</tr>
									`)
						$("#SL_GG").append($tr)
				}
            }

		}


		$(document).on("click", "#Xs_cq", function(e) {
			var num = $("#SL_wlkj").text() * 1
			var checkbox = $("#Xs_cq");
			if (checkbox.is(":checked")) {
				$("#SL_wlkj").text(num + 1500)
				$("#SL_wldj").text((num + 1500) / 1000000)
				$("#SL_wldj_2").text((num + 1500) / 1000000)
				console.log("多选框已被选中");
			} else {
				$("#SL_wlkj").text(num - 1500)
				$("#SL_wldj").text((num - 1500) / 1000000)
				$("#SL_wldj_2").text((num - 1500) / 1000000)
				console.log("多选框未被选中");
			}

			var sj = $("#SL_SJZL").val()
			var kj = $("#SL_wldj").text()

			if ($("#SL_WLFL").val() == "吸塑") {
				$("#SL_CLF").text((sj * kj).toFixed(4))
			} else {
				$("#SL_CLF").text((sj * kj * 1000).toFixed(4))
			}


			subtotal()
            var yf = $("#SL_YF").val() * 1
            var sum = 0
            $(".SL_FY_t").each(function (i, item) {
                sum += $(item).text() * 1
            })
            var num = 0
            $(".SL_FY_v").each(function (j, obj) {
                num += $(obj).val() * 1
            })
            var j_All = 0
            $(".SL_GY_jgf").each(function (x, index) {
                j_All += $(index).text() * 1
			})
			$("#SL_WLZJ1").text(((sum * 1 + num * 1 + j_All * 1).toFixed(4) * 1).toFixed(4))
		})

		function PrintingMaterialsCost(bomid) {
			var fl = $("#SL_WLFL").val()
			if (fl == "气泡枕") {
				fl = "葫芦膜"
			}
			$.ajax({
				url: "/Procure/Plastic_product",
				type: 'GET',
				data: {
					"state": 8,
					"miaoshu": fl
				},
				success: function(data) {
					$("#sl_ms option").remove()
					$("#sl_ms").append($(`<option value="0">@Resource.String1222</option>`))
					$.each(data, function(i, item) {
						$("#sl_ms").append($(`<option value="${item.PR_name}">${item.PR_name}</option>`))
					})
                    if (bomid != null) {
                        $.ajax({
                            url: "/Material/Index",
                            type: "POST",
                            data: {
                                "state": 9,
                                "BOM2_liao": bomid
                            },
							success: function (s) {
								console.log(s)
								var flflfll = $("#SL_WLFL").val()
								if (flflfll != "缓冲材") {
									if (flflfll == "吸塑") {
										if (s.wl_leng == "吸塑") {
                                            console.log(s.wl_leng)
											$("#Xs_cq").prop("checked", true)
										}
									}
									else if (flflfll == "塑料袋") {
                                        var shuEDFR = s == null ? "0" : s.wl_leng
                                        $("#SL_SLD_zl").val(shuEDFR)
									}
									PlasticBagClassification()
                                    if (s != null) {
                                        $("#SL_C").val(s.wl_c)
                                        $("#SL_K").val(s.wl_k)
                                        $("#SL_G").val(s.wl_g)
                                        $("#SL_H").val(s.wl_h)
                                        $("#SL_M").val(s.wl_m)
                                        $("#SL_MJ").val(s.wl_mj)
                                        $("#SL_LLJZ").val(s.wl_ll)
                                        $("#SL_SJZL").val(s.wl_sj)
                                    }
                                    var Prrid = s == null ? "-99" : s.prr_id;
									$.ajax({
										url: "/Material/Index",
										type: "POST",
										data: {
											"state": 10,
                                            "num": Prrid
										},
										success: function (s2) {
											$.each(s2, function (i, item) {
												console.log("材料添加成功+" + item.prrw_zc)
												$("#sl_ms").val(item.prrw_zc)
												change_sl_ProcessingCost()
											})
										},
										error: function (s) {
											alert("系统错误!");
										}
									})
									$.ajax({
										url: "/Material/Index",
										type: "POST",
										data: {
											"state": 13,
                                            "num": Prrid
										},
										success: function (s2) {
                                            if (s2 != null && s2 != "") {
                                                var xxx = 0
                                                $.each(s2, function (i, item) {
                                                    $("select[class=SL_JG]").each(function (i, sdd) {
                                                        $.each($(sdd).children(), function (i, idhjkd) {
                                                            var ss = $(idhjkd).val()
                                                            if (ss == item.pfw_zc) {
                                                                $(sdd).val(item.pfw_zc)
                                                                xxx += item.pfw_jia * 1
                                                                $(sdd).parent().next().text(item.pfw_jia)
                                                            }
                                                        })
                                                    })
                                                })
                                                console.log("工艺添加成功")
                                                $("#SL_JGFXJ").text(xxx)
                                                xxx = xxx * 1
                                                var ssldn = $("#SL_WLZJ1").text() * 1
                                                $("#SL_WLZJ1").text(xxx + ssldn)
                                            } else {
                                                setTimeout(function () {
                                                    console.log("JHHIIJIJIJIIJI")
                                                    $(".SL_JG").each(function (i, item) {
                                                        var shu = $(item)[0]
                                                        shu.options[1].selected = true;
                                                    })
                                                }, 1000);
                                            }
										},
										error: function (s) {
											alert("系统错误!");
										}
									})
								}
								else {
									if (s.wl_leng == "发泡EPP" || s.wl_leng == "发泡EPP" || s.wl_leng == "发泡EPP") {
										$("#HCC_ZL").val("2")

										$("#HC_FP").css({
											"display": "block"
										})
										$("#HC_CQ").css({
											"display": "none"
										})
										$("#FP_WLZL").val(s.wl_sj)
										$("#FP_ZL").val(s.wl_leng)
										Process_flow(s.wl_leng)
									}
									else {
                                        $("#HCC_ZL").val("1")
                                        $("#HC_FP").css({
                                            "display": "none"
                                        })
                                        $("#HC_CQ").css({
                                            "display": "block"
										})
                                        $.ajax({
                                            url: "/Material/Index",
                                            type: "POST",
                                            data: {
                                                "state": 10,
                                                "num": s.prr_id
                                            },
											success: function (s2) {
												$("#tab3_tbody tr").remove()
												var a1 = 0;
												var a2 = 0;
												var a3 = 0;
												var a4 = 0;
												$.each(s2, function (i, item) {
													var shdi = item.prrw_zc.split("+")
                                                    console.log(shdi[0])
                                                    console.log(shdi[0])
                                                    a1 += (((item.prrw_c * item.prrw_k * item.prrw_g / 1000000000) * item.prrw_shu)).toFixed(4)*1
                                                    a2 += ((shdi[0] * (item.prrw_c * item.prrw_k * item.prrw_g / 1000000000) * item.prrw_shu * ((1 + item.prrw_sh) * 0.01).toFixed(4)))*1
                                                    a3 += ((shdi[0] * (item.prrw_c * item.prrw_k * item.prrw_g / 1000000000) * item.prrw_shu * ((1 + item.prrw_sh) * 0.01) * 0.5).toFixed(4))*1
													a4 += (item.prrw_jia) * 1
													var $tr =
														$(`
															<tr>
																<th><input type="number" class="HC_GG" id="HC_C" value="${item.prrw_c}" style="width:60px;height:30px" /></th>
																<th><input type="number" class="HC_GG" id="HC_K" value="${item.prrw_k}" style="width:60px;height:30px" /></th>
																<th><input type="number" class="HC_GG" id="HC_G" value="${item.prrw_g}" style="width:60px;height:30px" /></th>
																<th>
																	<select id="HC_MD" value="" style="width:60px;height:30px">
																		<option value="${item.prrw_zc}">${item.prrw_zc}</option>
																		@foreach (var item in ViewBag.par as List<parice>)
																		{
																			if (@item.PA_LengBie == "裁切缓冲材")
																			{
																				<option value="@item.PA_T+@item.PA_ZhongL">@item.PA_ZhongL</option>
																			}

																		}
																	</select>
																</th>
																<th>${shdi[0]}</th>
																<th><input type="number" class="HC_GG" id="HC_SL" style="width:60px;height:30px" value="${item.prrw_shu}"/></th>
																<th class="HC_TJ_c">${((item.prrw_c * item.prrw_k * item.prrw_g / 1000000000) * item.prrw_shu).toFixed(8)}</th>
																<th><input type="number" class="HC_GG" id="HC_SH" style="width:60px;height:30px" value="${item.prrw_sh}"/></th>
																<th class="HC_clf">${(shdi[0] * (item.prrw_c * item.prrw_k * item.prrw_g / 1000000000) * item.prrw_shu * (1 + item.prrw_sh * 0.01).toFixed(4))}</th>
																<th class="HC_jgf">${(shdi[0] * (item.prrw_c * item.prrw_k * item.prrw_g / 1000000000) * item.prrw_shu * (1 + item.prrw_sh * 0.01) * 0.5).toFixed(4)}</th>
																<th class="HC_cb">${item.prrw_jia}</th>
																<th><a href="#" id="HC_CZ">删除</a></th>
															</tr>
														`)
													$("#tab3_tbody").append($tr)
												})
												$("#ALL_TJ").text(a1)
                                                $("#ALL_CL_price").text(a2)
                                                $("#ALL_JG_price").text(a3)
                                                $("#ALL_CB_price").text(a4)
												var $tr =
													$(`
														<tr>
															<th><input type="number" class="HC_GG" id="HC_C" style="width:60px;height:30px" /></th>
															<th><input type="number" class="HC_GG" id="HC_K" style="width:60px;height:30px" /></th>
															<th><input type="number" class="HC_GG" id="HC_G" style="width:60px;height:30px" /></th>
															<th>
																<select id="HC_MD" value="" style="width:60px;height:30px">
																	<option>@Resource.String1189</option>
																	@foreach (var item in ViewBag.par as List<parice>)
																	{
																		if (@item.PA_LengBie == "裁切缓冲材")
																		{
																			<option value="@item.PA_T+@item.PA_ZhongL">@item.PA_ZhongL</option>
																		}

																	}
																</select>
															</th>
															<th></th>
															<th><input type="number" class="HC_GG" id="HC_SL" style="width:60px;height:30px" value="1"/></th>
															<th class="HC_TJ_c"></th>
															<th><input type="number" class="HC_GG" id="HC_SH" style="width:60px;height:30px" value="10"/></th>
															<th class="HC_clf"></th>
															<th class="HC_jgf"></th>
															<th class="HC_cb"></th>
															<th><a href="#" id="HC_CZ">@Resource.String1063</a></th>
														</tr>
														`)
												$("#tab3_tbody").append($tr)
                                            },
                                            error: function (s) {
                                                alert("系统错误!");
                                            }
                                        })
									}
								}

                            },
                            error: function (s) {
                                alert("系统错误!");
                            }
                        })
                    }
				},
				error: function() {
					alert('Request Error');
				}
			})
		}

		//获取加工费
		function ObtainProcessingFee() {
			var fl = $("#SL_WLFL").val()
			if (fl != "缓冲材") {
				if (fl == "胶带") {
					$.ajax({
						url: "/Procure/Plastic_product",
						type: 'GET',
						data: {
							"state": 4,
							"miaoshu": fl
						},
						success: function(data) {
							$("#SL_JGF_1 tbody tr").remove()
                            var $tr = $(`
										 <tr>
											 <td>
												 <select style="width:125px;height:25px" id="SL_JG" class="SL_JG" name="dshd">
													 <option value="0">无</option>
												 </select>
											 </td>
											 <td class="SL_JGF"></td>
										 </tr>
										`)
							$("#SL_JGF_1 tbody").append($tr)

							$.each(data, function(i, obj) {
                                if (obj.LB_ID == 4039 || obj.LB_ID == 4038) {
									var $tr = $(`
										 <tr>
											 <td>
												 <select style="width:125px;height:25px" id="SL_JG" class="SL_JG">
													 <option value="0">@Resource.String1051</option>
													 <option value="${obj.LB_jia}+${obj.LB_fne}">${obj.LB_fne}</option>
												 </select>
											 </td>
											 <td class="SL_JGF"></td>
										 </tr>
										`)
									$("#SL_JGF_1 tbody").append($tr)
								}
								else {
                                    var $tr = $(`<option value="${obj.LB_jia}+${obj.LB_fne}">${obj.LB_fne}</option>`)
                                    $("select[name=dshd]").append($tr)
								}

							})
						},
						error: function() {
							alert('Request Error');
						}
					})
				}
				else if(fl == "塑料袋"){
					$.ajax({
						url: "/Procure/Plastic_product",
						type: 'GET',
						data: {
							"state": 4,
							"miaoshu": fl
						},
						success: function (data) {
							$("#SL_JGF_1 tbody tr").remove()
							var $tr = $(`
										 <tr>
											 <td>
												 <select style="width:125px;height:25px" id="SL_JG" class="SL_JG" name="dshd">
													 <option value="0">无</option>
												 </select>
											 </td>
											 <td class="SL_JGF"></td>
										 </tr>
										`)
							$("#SL_JGF_1 tbody").append($tr)

							$.each(data, function (i, obj) {
								if (obj.LB_ID == 4032) {
									var $tr = $(`
										 <tr>
											 <td>
												 <select style="width:125px;height:25px" id="SL_JG" class="SL_JG">
													 <option value="0">@Resource.String1051</option>
													 <option value="${obj.LB_jia}+${obj.LB_fne}">${obj.LB_fne}</option>
												 </select>
											 </td>
											 <td class="SL_JGF"></td>
										 </tr>
										`)
									$("#SL_JGF_1 tbody").append($tr)
								}
								else {
									var $tr = $(`<option value="${obj.LB_jia}+${obj.LB_fne}">${obj.LB_fne}</option>`)
									$("select[name=dshd]").append($tr)
								}

							})
						},
						error: function () {
							alert('Request Error');
						}
					})
				}
				else {
					$.ajax({
						url: "/Procure/Plastic_product",
						type: 'GET',
						data: {
							"state": 4,
							"miaoshu": fl
						},
						success: function(data) {
							$("#SL_JGF_1 tbody tr").remove()
							$.each(data, function(i, obj) {
								var $tr = $(`
									 <tr>
										 <td>
											 <select style="width:125px;height:25px" id="SL_JG" class="SL_JG">
												 <option value="0">@Resource.String1051</option>
												 <option value="${obj.LB_jia}+${obj.LB_fne}">${obj.LB_fne}</option>
											 </select>
										 </td>
										 <td class="SL_JGF"></td>
									 </tr>
									`)
								$("#SL_JGF_1 tbody").append($tr)
							})
						},
						error: function() {
							alert('Request Error');
						}
					})
				}
			}
		}
		//塑料制品SL_CLF
        //计算运费小计
        function subtotal() {
            var fl = $("#SL_WLFL").val()
            if (fl == "气泡袋") {
                var MJ = $("#SL_MJ").val()
                $("#SL_YF").val(MJ * 0.1)
                $("#SL_YFXJ").text($("#SL_YF").val())
            } else if (fl == "塑料袋") {
                var CLF = $("#SL_CLF").text()
                $("#SL_YF").val(CLF * 0.02)
                $("#SL_YFXJ").text($("#SL_YF").val())
            } else if (fl == "胶带") {
                var jgf = $("#SL_JGFXJ").text() * 1
                var flf = $("#SL_FLFXJ").text() * 1
                var clf = $("#SL_CLF").text() * 1
                console.log(jgf, flf, clf)
                $("#SL_YF").val((jgf + flf + clf) * 0.05)
                $("#SL_YFXJ").text($("#SL_YF").val())
			}
			else if (fl == "吸塑") {
				var jg = $("#SL_CLF").text() * 1
				$("#SL_YF").val((jg * 0.05).toFixed(4))
            } else if (fl == "铝箔") {
                var CLF = $("#SL_CLF").text()
                $("#SL_YF").val(CLF * 0.02)
                $("#SL_YFXJ").text($("#SL_YF").val())
            }else {
                $("#SL_YF").val()
                $("#SL_YFXJ").text($("#SL_YF").val())
            }
        }
        //根据种类搜索加工费损耗
        function change_sl_ProcessingCost() {
            var sl_ms = $("#sl_ms").val()
            var sl_ms1 = $("#SL_WLFL").val()
			console.log(sl_ms, sl_ms)
            if (sl_ms1 == "铝箔") {
                $.ajax({
                    url: "/Procure/Plastic_product",
                    type: 'GET',
                    data: {
                        "state": 10,
                        "miaoshu": sl_ms
                    },
                    success: function (data) {
                        Print_plastic_composition11(data)
                        Gram_value()
                        Calculated_size()
                        subtotal()
                        SUM_price()
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
			} else {
                $.ajax({
                    url: "/Procure/Plastic_product",
                    type: 'GET',
                    data: {
                        "state": 1,
                        "miaoshu": sl_ms
                    },
                    success: function (data) {
                        Print_plastic_composition(data)
                        Gram_value()
                        Calculated_size()
                        subtotal()
                        SUM_price()
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
			}

        }
        //计算物料材料费
        function Calculated_size() {
            var sj = $("#SL_SJZL").val()
            var MJ = $("#SL_MJ").val()
            var kj = $("#SL_wldj").text()
            var kj1 = $(".CL_PMjia").text()
            console.log(3, sj, kj, kj1)
            if ($("#SL_WLFL").val() == "吸塑") {
                $("#SL_CLF").text((sj * kj).toFixed(4))
			}
            else if ($("#SL_WLFL").val() == "胶带") {
                $("#SL_CLF").text((sj * kj * 1000 * 1.05).toFixed(4))
			} else if ($("#SL_WLFL").val() == "铝箔") {
                $("#SL_CLF").text((MJ * kj1).toFixed(4))
			}
			else {
                $("#SL_CLF").text((sj * kj * 1000).toFixed(4))
            }
        }
        //打印塑料组成
        function Print_plastic_composition(data) {
            $('#SL_WLZC tr').remove();
            $.each(data, function (i, item) {
                var $tr = $(`
				<tr style="background-color:#E8ECF6">
					<td id="SL_ZC_name">${item.PA_ZhongL}</td>
					<td id="SL_ZC_sl">${item.PR_dai}</td>
					<td id="SL_ZC_dz">${item.PA_T}</td>
					<td class="CL_jg">${item.PA_T * item.PR_dai}</td>
				</tr>
			`);
                $('#SL_WLZC').append($tr);
            })
		}
		//铝箔打印
        function Print_plastic_composition11(data) {
			$('#SL_WLZC tr').remove();
			var NJHM=""
            $.each(data, function (i, item) {
                var $tr = $(`
					<tr style="background-color:#E8ECF6">
						<td id="SL_ZC_name">${item.PA_ZhongL}</td>
						<td id="SL_ZC_sl">${item.PR_dai}</td>
						<td id="SL_ZC_dz">${item.PA_T*1000}</td>
						<td class="CL_jg">${item.PA_T * 1000 * item.PR_dai}</td>
						<td class="CL_PMjia">${item.PA_T * 1 * item.KZ / 1000}</td>
					</tr>
				`);
                $('#SL_WLZC').append($tr);
                NJHM = item.KZ;
			})
			$('#SL_M').val(NJHM);
            $('.inp').trigger('keyup');
        }
        $(document).on("click", "#KMJLM", function (e) {
            SUM_price()
        })
        //计算物料总价
        function SUM_price() {
            var sum = 0
            var zl = $("#sl_wlfl").val()
            var yf = $("#SL_YF").val() * 1
            $(".SL_FY_t").each(function (i, item) {
                sum += $(item).text() * 1
            })
            var num = 0
            $(".SL_FY_v").each(function (j, obj) {
                num += $(obj).val() * 1
            })
            var j_All = 0
            $(".SL_GY_jgf").each(function (x, index) {
                j_All += $(index).text() * 1
            })
            var HUMK = 1
            if ($("#KMJLM").prop("checked")) {
                HUMK = 0.5
            }
            $("#SL_WLZJ1").text(((sum * 1 + num * 1 + j_All * 1).toFixed(4) * 1 ) * HUMK)

        }
        //计算物料克价格
        function Gram_value() {
            var sum = 0

            $(".CL_jg").each(function (i, item) {
                sum += $(item).text() * 1
            })

            if ($("#SL_WLFL").val() == "吸塑") {
                sum = (sum / 0.95 + 2000) / 0.7 + 2000
                var checkbox = $("#Xs_cq");
                if (checkbox.is(":checked")) {
                    sum = sum * 1 + 1500
                    console.log("多选框已被选中");
                }
            } else {
                sum = sum * 1
            }
            $("#SL_wlkj").text(sum.toFixed(4))
            $("#SL_wldj").text((sum / 1000000).toFixed(6))
            $("#SL_wldj_2").text((sum / 1000000).toFixed(6))
        }
		$(function() {
			//spec()//格局物料类型显示规格计算
			//
			AuxiliaryPanel() //根据物料类型来显示辅料
			//BlisterProcessFlow()

			//计算辅料费小计
			function AccessoriesSubtotal() {
				var sum = 0
				$(".SL_FLJG").each(function(i, item) {
					sum += $(item).val() * 1
				})
				$("#SL_FLFXJ").text(sum)
			}

			//解锁辅料价格
			function Unlock(e) {
				if (e.val() == "纸管") {
					if (e.prop("checked")) {
						var name = e.val()
						$.ajax({
							url: "/Procure/Plastic_product",
							type: 'GET',
							data: {
								"state": 3,
								"miaoshu": name
							},
							success: function(data) {
								var k = $("#SL_K").val() //宽
								$.each(data, function(i, item) {
									e.parent().next().next().children().remove()
									e.parent().next().next().append($(`<input class="SL_FLJG" id="SL_FLJG" type="number" value="${(item.PA_T * (k / 1000)).toFixed(4) }" />`))
								})
								var sum = 0
								$(".SL_FLJG").each(function(i, item) {
									sum += $(item).val() * 1
								})
								$("#SL_FLFXJ").text(sum)
							},
							error: function() {
								alert('Request Error');
							}
						})
					} else {
						e.parent().next().next().children().remove()
					}
				} else if (e.val() == "纸箱") {
					if (e.prop("checked")) {
						e.parent().next().next().children().remove()
						e.parent().next().next().append($(`<input class="SL_FLJG" id="SL_FLJG" type="number" />`))
					} else {
						e.parent().next().next().children().remove()
					}
				}
				AccessoriesSubtotal()
			}
			//获取加工费


			//修改产品实际克重修改加工费
			function NetWeightProcessingCharge() {
				var K = $("#SL_SJZL").val()*1
				var fl = $("#SL_WLFL").val()

				if (fl != "缓冲材" && fl != "吸塑") {
					$(".SL_JG").each(function (i, item) {
						var gy = $(item).val()
						console.log(gy)
						var gyf = gy.split('+')
						var gyf1 = gyf[0]
                        console.log(1, K, gyf)
						if (gyf != 0) {
                            $(item).parent().next().text(K * gyf1)
						}
						else {
                            $(item).parent().next().text(0.00)
						}
					})
				}
			}
			//计算工艺小计
			function Process_subtotal() {
				var sum = 0
				$(".SL_JGF").each(function(i, item) {
					sum += $(item).text() * 1
				})
				$("#SL_JGFXJ").text(sum)
			}

			//获取加工费费用
			function Get_AuxiliaryMaterialsCost(e) {
				var gy = e.val().split("+")
				var gyf = gy[0]
				if (gyf != null) {
					var fl = $("#SL_WLFL").val()
					if (fl == "胶带") {
						var jia = gyf * 1
						var MJ = $("#SL_MJ").val() * 1
						e.parent().next().text((jia * MJ).toFixed(6))
					} else {
						var jia = gyf * 1
						console.log(jia)
						var shj = $("#SL_SJZL").val() * 1
						console.log(shj)
						e.parent().next().text((jia * shj).toFixed(6))
					}
				}
			}


			//修改净重计算加工费
			function Netweight_Processingfee() {
				var zl = $("#sl_wlfl").val()
				if (zl == "胶带") {
					var c = $("#SL_C").val() //长
					var k = $("#SL_K").val() //宽
					var KG = (c / 1000) * (k / 1000)
					$(".SL_GYLC").each(function (i, item) {
						var jia = $(item).val()
						$(item).parent().next().next().text((KG * jia).toFixed(4))
					})
				} else if (zl == "气泡袋") {
					var KG = $("#SL_wlzl").text()
					$(".SL_GYLC").each(function (i, item) {
						var jia = $(item).val()
						$(item).parent().next().next().text(((KG / 1000) * jia).toFixed(4))
					})
                }
				else {
					var KG = $("#SL_SJZL").val()
					$(".SL_GYLC").each(function(i, item) {
						var jia = $(item).val()
						$(item).parent().next().next().text((KG * jia).toFixed(4))
					})
				}
			}
			//修改物料克重重新计算运费
			function freight() {
				var zl = $("#sl_wlfl").val()
				var clf = $("#SL_CLF").text()
				var c = $("#SL_C").val()
				var k = $("#SL_K").val()
				var yf = clf * 0.02
				console.log(zl)
				if (zl == "塑料袋") {
					$("#SL_YF").val((yf).toFixed(4))
				} else if (zl == "气泡袋") {
					$("#SL_YF").val(c * k / 1000000 * 2 * 0.1)
				}
			}
            //切换塑料袋种类
            $(document).on("change", "#SL_SLD_zl", function () {

                PlasticBagClassification()
			})

			function PlasticBagSpecification() {
				console.log(3,"计算尺寸")
				var fl = $("#SL_WLFL").val()
				var sld = $("#SL_SLD_zl").val()
				var C = $("#SL_C").val()*1
				var K = $("#SL_K").val()*1
				var G = $("#SL_G").val()*1
				var M = $("#SL_M").val()*1
				var H = $("#SL_H").val()*1
				var MJ = $("#SL_MJ").val()*1
				if (fl == "塑料袋") {
					if (sld == 1) {
						$("#SL_MJ").val((C / 1000 * K / 1000).toFixed(6))
						$("#SL_LLJZ").val((((C / 1000 * K / 1000)) * M * H).toFixed(6))
					} else if (sld == 2) {
						$("#SL_MJ").val(((C / 1000) * (K / 1000) * 2).toFixed(6))
						$("#SL_LLJZ").val((((C / 1000 * K / 1000 * 2)) * M * H).toFixed(6))
					} else if (sld == 3) {
						$("#SL_MJ").val((((C + K) * 2 * G + C * K) / 1000000).toFixed(6))
						$("#SL_LLJZ").val((MJ * M * H).toFixed(6))
					} else if (sld == 4) {
						$("#SL_MJ").val(((C + K * 2) * 2 / 1000 * (G / 1000)).toFixed(6))
						$("#SL_LLJZ").val(((((C + K * 2) * 2 / 1000 * (G / 1000))) * M * H).toFixed(6))
					} else if (sld == 5) {
						$("#SL_MJ").val(((C / 10) * (K / 10) * 2).toFixed(6))
						$("#SL_LLJZ").val((((((C / 10) * (K / 10) * 2)) * M * H / 10) * 1.15 / 1000).toFixed(6))
					}
				} else if (fl == "缠绕膜") {
					$("#SL_LLJZ").val((C * (K / 1000) * H * M).toFixed(6))
				} else if (fl == "气泡枕" || fl == "葫芦膜") {
					$("#SL_LLJZ").val((C * (K / 1000) * H * M * 2).toFixed(6))
				} else if (fl == "气泡袋") {
					$("#SL_MJ").val((C * K / 1000000 * 2).toFixed(6))
					$("#SL_SJZL").val((((C * K / 1000000 * 2)) * G / 1000).toFixed(6))
				} else if (fl == "胶带") {
					$("#SL_MJ").val((C * K / 1000).toFixed(6))
					$("#SL_SJZL").val((((C * K / 1000)) * H / 1000 * M).toFixed(6))
                } else if (fl == "铝箔"){
                    if (sld == 1) {
                        $("#SL_MJ").val((C * K / 1000).toFixed(6))
                        $("#SL_LLJZ").val((((C  * K / 1000)) * M ).toFixed(6))
                        $("#SL_SJZL").val((((C  * K / 1000)) * M ).toFixed(6))
                    } else if (sld == 2) {
                        $("#SL_MJ").val(((C / 1000) * (K / 1000) * 2).toFixed(6))
                        $("#SL_LLJZ").val((((C / 1000 * K / 1000 * 2)) * M ).toFixed(6))
                        $("#SL_SJZL").val((((C / 1000 * K / 1000 * 2)) * M ).toFixed(6))
                    } else if (sld == 3) {
                        $("#SL_MJ").val((((C + K) * 2 * G + C * K) / 1000000).toFixed(6))
                        $("#SL_LLJZ").val((((C + K) * 2 * G + C * K) / 1000000 * M ).toFixed(6))
                        $("#SL_SJZL").val((((C + K) * 2 * G + C * K) / 1000000 * M ).toFixed(6))
                    } else if (sld == 4) {
                        $("#SL_MJ").val(((C + K * 2) * 2 / 1000 * (G / 1000)).toFixed(6))
                        $("#SL_LLJZ").val(((((C + K * 2) * 2 / 1000 * (G / 1000))) * M ).toFixed(6))
                        $("#SL_SJZL").val(((((C + K * 2) * 2 / 1000 * (G / 1000))) * M ).toFixed(6))
                    }
				}
			}
			function TotalMaterial() {

			}

			//切换物料种类
			//$(document).on("change", "#SL_WLFL", function() {
			//	$("#sl_ms").val("0")
			//	$("#SL_WLZC tr").remove()
			//	$("#SL_wldj").text(0)
			//	$("#SL_CLF").text(0)
			//	PrintingMaterialsCost()
			//	BlisterProcessFlow()
			//	AuxiliaryPanel()
			//	spec()
			//	subtotal()
			//	ObtainProcessingFee()
   //             PlasticBagClassification()
			//})

			//
			$(document).on("keyup", "#SL_FLJG", function() {
				AccessoriesSubtotal()
			})
			//点击多选框选择辅料辅料
			$(document).on("click", ".SL_FLXZ", function (e) {
				if ($("#SL_WLFL").val() == "铝箔") {
					var ZL = $("#SL_SJZL").val()*1  //重量
					var NJS = $(e.target).parent().next().next().children().val()*1//价格
					var SL = $(e.target).parent().next().text()//mingc
                    console.log(ZL, NJS, SL)
					if ($(e.target).prop("checked")) {
						if (SL == "制袋") {
							$(e.target).parent().next().next().next().text(ZL * NJS / 1000)
						} else {
							$(e.target).parent().next().next().next().text(NJS)
                            $('.FLJGF').prop('checked', true);
							$("#SL_JGFXJ").text(0.5)
						}
					} else {
						if (SL != "制袋") {
							$('.FLJGF').prop('checked', false);
							$("#SL_JGFXJ").text(0)
						}
                        $(e.target).parent().next().next().next().text(0)
					}
                    var sum = 0
                    $(".SL_FLXZ").each(function (i, item) {
						sum += $(item).parent().next().next().next().text() * 1
                    })
					$("#SL_FLFXJ").text(sum)
                    SUM_price()
				} else {
                    Unlock($(e.target))
				}
			})
			//切换获取加工费价格
			$(document).on("change", "#SL_JG", function (e) {
				Get_AuxiliaryMaterialsCost($(e.target))
				Process_subtotal()
				SUM_price()
			})
			//切换工艺计算加工费
			$(document).on("change", ".SL_GYLC", function(e) {
				Netweight_Processingfee()
				SUM_price()
			})
			//运费/纸箱输入框输入触发
			$(document).on("keyup", ".SL_FY_v", function() {
				SUM_price()
			})
			//修改物料实际克重
			$(document).on("keyup", "#SL_SJZL", function() {
				NetWeightProcessingCharge()
				Process_subtotal()
				Calculated_size()
				Netweight_Processingfee()
				SUM_price()
				freight()
				subtotal()
			})

			//点击切换原材料种类
			$(document).on("change", "#sl_ms", function() {
				NetWeightProcessingCharge()
				change_sl_ProcessingCost()

			})
			//修改长宽事件
			$(document).on("keyup", ".inp", function() {
				NetWeightProcessingCharge()
				Calculated_size()
				PlasticBagSpecification()
				subtotal()
				SUM_price()
			})

			//提交计算结果
			$("#SHULbec").click(function() {
				var name = $("#wulm").text()
                var lh = $("#bomindy").text()
				var fl1 = $("#flelei").text()
				var fl2 = $("#fellei2").text()
				var sllx = $("#SL_SLD_zl").val()
                var sjzl = $("#SL_SJZL").val()
                if ($("#SL_WLFL").val() == "吸塑" && $("#Xs_cq").prop("checked") == true) {
                    sllx="吸塑"
				}
				if ($("#SL_WLFL").val() == "缓冲材") {
					var tempwww = $("#HCC_ZL").val()
					if (tempwww == "发泡缓冲材") {
						sllx = $("#FP_ZL").val()
						sjzl= $("#FP_WLZL").val()
					}
					else if (temp = "裁切缓冲材") {
                        sllx ="裁切缓冲材"
					}
				}
				var gyjl = {
					wl_name: name,
					wl_liao: lh,
					wl_fen: fl1,
					wu_fenLei: fl2,
					wl_leng: sllx,
					wl_c: $("#SL_C").val(),
                    wl_k: $("#SL_K").val(),
                    wl_g: $("#SL_G").val(),
                    wl_h: $("#SL_H").val(),
                    wl_m: $("#SL_M").val(),
                    wl_mj: $("#SL_MJ").val(),
                    wl_ll: $("#SL_LLJZ").val(),
                    wl_sj: sjzl,
				}

				console.log(gyjl)

				$.ajax({
					url: '/Material/AddProcessRecord',
					type: 'POST',
					data: gyjl,
					success: function(data) {
						var GYLC_CL = [];
						var GYLC_GY = [];
						//材料费
						if ($("#SL_WLFL").val() == "缓冲材") {
							if ($("#HCC_ZL").val() == "1") {
								$("#tab3_tbody tr").each(function (index, obj) {
                                    var Thuan = "";
                                    if ($("select[id=HC_MD]", obj).val() != "密度（）" && $("th[class=HC_cb]", obj).text() != null) {
										var ssdj = $("select[id=HC_MD]", obj).val().split("+")
										var ddlw = ssdj[1]
										alert(ddlw)

                                        $.ajax({
                                            url: "/Material/Addpaid",
                                            type: 'GET',
                                            data: {
                                                "name": ddlw
                                            },
                                            success: function (data1) {
                                                $("#knds").text(data1)
                                            },
                                            error: function () {
                                                alert('Request Error');
                                            }
										})

                                        GYLC_CL.push({
                                            prrw_jia: $("th[class=HC_cb]", obj).text(),
                                            prrw_guige: $("input[id=HC_C]", obj).val() + "*" + $("input[id=HC_K]", obj).val() + "*" + $("input[id=HC_G]", obj).val(),
                                            prrw_shu: $("input[id=HC_SL]", obj).val(),
                                            prr_id: data,
                                            prrw_c: $("input[id=HC_C]", obj).val(),
                                            prrw_k: $("input[id=HC_K]", obj).val(),
                                            prrw_g: $("input[id=HC_G]", obj).val(),
                                            cl_id: $("#knds").text(),
                                            prrw_zc: $("select[id=HC_MD]", obj).val(),
                                            prrw_sh: $("input[id=HC_SH]", obj).val(),
                                        })
                                    }
                                })
                                console.log("共" + GYLC_CL.length + "数据");
                                console.log(GYLC_CL);
                                $.ajax({
                                    url: "/Material/addCraftMaterials",
                                    type: "POST",
                                    data: JSON.stringify(GYLC_CL),
                                    contentType: "application/json;charset=utf-8",
                                    dataType: "json",
                                    success: function (text) {
                                        console.log(text)
                                    },
                                    error: function (text) {
                                        alert("系统错误" + text);
                                    }
                                })
							}
						}
						else {
							if ($("#SL_WLFL").val() != "吸塑") {
                                $("#SL_WLZC tr").each(function (index, obj) {
									var Thuan = "";
                                    if ($("td[id=SL_ZC_name]", obj).text() != "") {
										$.ajax({
											url: "/Material/Addpaid",
											type: 'GET',
											data: {
												"name": $("td[id=SL_ZC_name]", obj).text()
											},
											success: function (data1) {
												$("#knds").text(data1)
											},
											error: function () {
											}
										})
									}
                                    GYLC_CL.push({
                                        prrw_jia: "0" /*$("#SL_SJZL").val() * $("td[id='SL_ZC_sl']", obj).text() * $("td[id='SL_ZC_dz']", obj).text()*/,
                                        prrw_guige: $("#SL_SJZL").val(),
                                        prrw_shu: $("td[id='SL_ZC_sl']", obj).text(),
                                        prr_id: data,
										prrw_zc: $("#sl_ms").val(),
                                        cl_id: $("#knds").text(),
                                    })
								})
							}
							else {
                                GYLC_CL.push({
                                    prrw_jia: "0" /*$("#SL_SJZL").val() * $("td[id='SL_ZC_sl']", obj).text() * $("td[id='SL_ZC_dz']", obj).text()*/,
                                    prrw_guige: $("#SL_SJZL").val(),
                                    prrw_shu:"1" /*$("td[id='SL_ZC_sl']", obj).text()*/,
                                    prr_id: data,
                                    prrw_zc: $("#sl_ms").val()
                                })
							}

                            console.log("共" + GYLC_CL.length + "数据");
                            console.log(GYLC_CL);
                            $.ajax({
                                url: "/Material/addCraftMaterials",
                                type: "POST",
                                data: JSON.stringify(GYLC_CL),
                                contentType: "application/json;charset=utf-8",
                                dataType: "json",
                                success: function (text) {
                                    console.log(text)
                                },
                                error: function (text) {
                                    alert("系统错误" + text);
                                }
							})

                            //工艺
                            $("#SL_JGF_1_2 tr").each(function (index, obj2) {
                                if ($("select[id='SL_JG']", obj2).val() != null || $("select[id='SL_JG']", obj2).val() != "0") {
                                    var gy = $("select[id='SL_JG']", obj2).val().split("+")
                                    var gym = gy[1]
									var gyf = gy[0]

                                    GYLC_GY.push({
                                        pfw_jia: gyf * $("#SL_SJZL").val(),
                                        pfw_gg: $("#SL_SJZL").val(),
										prr_id: data,
                                        pfw_zc: $("select[id='SL_JG']", obj2).val()
									})

                                    console.log("共" + GYLC_GY.length + "数据");
									console.log(GYLC_GY);

                                    $.ajax({
                                        url: "/Material/addProcessFlow",
                                        type: "POST",
                                        data: JSON.stringify(GYLC_GY),
                                        contentType: "application/json;charset=utf-8",
                                        dataType: "json",
                                        success: function (text) {
                                            console.log(text)
                                        },
                                        error: function (text) {
                                            alert("系统错误" + text);
                                        }
                                    })
                                }

                            })
						}

					},
					error: function() {
						alert("系统错误");
					}
				})
				var HEji1 = "";
				var sel1 = $("#SL_WLFL").val();
				var sel2 = $("#HCC_ZL").val();
				console.log(sel1);
				console.log(sel2);
				//胶带  塑料袋  气泡枕  葫芦袋  气泡袋  缠绕膜
				//裁切  1 2
				if (sel1 != "缓冲材" && sel2 == "0") {
                    HEji1= $("#SL_WLZJ1").text()
				}
				else if (sel1 == "缓冲材" && sel2 == "1") {
					HEji1 = $("#ALL_CB_price").text()
				}
				else if (sel1 == "缓冲材" && sel2 == "2") {
                    HEji1 = $("#FP_ZJG").text()
				}

				if (sel1 == "塑料袋" || sel1=="吸塑") {
					HEji1 = $("#SL_WLZJ1").text()

                }
				var OPtas = {
					OP_price: HEji1,
					OP_YUN: $("#SL_YFXJ").text(),
					OP_CAi: $("#SL_CLF").text(),
					OP_JIA: $("#SL_JGFXJ").text()
				}

				$.ajax({
					url: '/Material/APPoptiosjn',
					type: 'POST',
					data: {
						"OPtas": OPtas,
						"BOM2_id": BOM2_ids,
						"stannd": 1
					},
					success: function(e) {
						alert(e);
						$("#SHUliao").css("display", "none");
                        location.reload(true);

					},
					error: function() {
						alert("系统错误");
					}
				})
			})
		})
        //搜索发泡缓冲料工艺流程
        function Process_flow(e) {
            var zl = e
            $.ajax({
                url: "/Procure/Plastic_product",
                type: 'GET',
                data: {
                    "state": 6,
                    "miaoshu": zl
                },
                success: function (data) {
					Printing_process_flow(data)
                    Calculate_the_price()
                },
                error: function () {
                    alert('Request Error');
                }
            })
		}
        //打印工艺流程
        function Printing_process_flow(data) {
            $("#FP_GY_tb tr").remove()
            $.each(data, function (i, item) {
                var id = item.LB_ID
                var $tr = $(`
				<tr>
					<td>${item.RO_yao}</td>
					<td class="FP_GYJG">${item.RO_bei}</td>
				</tr>
				`);
                $("#FP_GY_tb").append($tr)

            })
		}
        //计算总价格
        function Calculate_the_price() {
            var sum = 0
            var z = $("#FP_WLZL").val()
            $(".FP_GYJG").each(function (i, item) {

                sum += $(item).text() * 1
            })
            var jia = z * sum
            $("#FP_ZJG").text((jia).toFixed(5))
        }
		//裁切缓冲材
		$(function() {
			//切换密度查找立方价
			$(document).on("change", "#HC_MD", function (e) {
                var dj = $(e.target).val().split("+")
                var jg = dj[0]
				var jia = $(e.target).val() //立方价格
                $(e.target).parent().next().text(jg)
				ALL_price()
			})
			//改变长/宽/高/数量/损耗时触发
			$(document).on("keyup", ".HC_GG", function(e) {
				Calculated_volume($(e.target)) //计算体积
				price($(e.target)) //计算费用
                Processing_cost()//计算工艺
				ALL_price()
			})
			//改变密度时触发
			$(document).on("change", "#HC_MD", function(e) {
				price($(e.target))
				ALL_price()
			})
			//点击添加时触发
			$(document).on("click", "#HC_CZ", function(e) {
				Table_row($(e.target))
				ALL_price()
			})
			//添加和删除行的方法
			function Table_row(e) {
				var zt = e.text()
				console.log(zt)
				if (zt == "@Resource.String1063") {
					e.text("@Resource.String733")
					var $tr = $(`
							<tr>
								<th><input type="number" class="HC_GG" id="HC_C" style="width:60px;height:30px" /></th>
								<th><input type="number" class="HC_GG" id="HC_K" style="width:60px;height:30px" /></th>
								<th><input type="number" class="HC_GG" id="HC_G" style="width:60px;height:30px" /></th>
								<th>
									<select id="HC_MD" value="" style="width:60px;height:30px">
										<option>@Resource.String1189</option>
										@foreach (var item in ViewBag.par as List<parice>)
										{
											if (@item.PA_LengBie == "裁切缓冲材")
											{
												<option value="@item.PA_T+@item.PA_ZhongL">@item.PA_ZhongL</option>
											}

										}
									</select>
								</th>
								<th></th>
								<th><input type="number" class="HC_GG" id="HC_SL" style="width:60px;height:30px" value="1"/></th>
								<th class="HC_TJ_c"></th>
								<th><input type="number" class="HC_GG" id="HC_SH" style="width:60px;height:30px" value="10"/></th>
								<th class="HC_clf"></th>
								<th class="HC_jgf"></th>
								<th class="HC_cb"></th>
								<th><a href="#" id="HC_CZ">@Resource.String1063</a></th>
							</tr>
							`)
					$("#tab3_tbody").append($tr)
				} else {
					e.parent().parent().remove()
				}
			}
			//计算价格的方法
			function price(e) {
				var jia = e.parent().parent().children().eq(4).text() //立方价

				var tj = e.parent().parent().children().eq(6).text() //体积

				var sh = e.parent().parent().children().eq(7).children().val() //损耗

				var clf = jia * tj * (1 + sh * 0.01) //材料费
				var jgf = clf * 0.5 //加工费
				var cbkg = clf * 1 + jgf * 1 //成本价格

				e.parent().parent().children().eq(8).text((clf).toFixed(4)) //材料费
				e.parent().parent().children().eq(9).text((jgf).toFixed(4)) //加工费
				e.parent().parent().children().eq(10).text((cbkg).toFixed(4)) //成本价格
			}
			//计算体积的方法
			function Calculated_volume(e) {
				var c = e.parent().parent().children().eq(0).children().val() //长
				var k = e.parent().parent().children().eq(1).children().val() //宽
				var g = e.parent().parent().children().eq(2).children().val() //高
				var s = e.parent().parent().children().eq(5).children().val() //数量
				var tj = c * k * g / 1000000000 * s
				e.parent().parent().children().eq(6).text((tj).toFixed(8))
			}
			//计算总价的方法
			function ALL_price() {
				var clf = 0
				var jhf = 0
				var cb = 0
				var tj = 0
				$(".HC_clf").each(function(i, item) {
					clf += $(item).text() * 1
				})
				$("#ALL_CL_price").text((clf).toFixed(5))

				$(".HC_TJ_c").each(function(i, obj) {
					tj += $(obj).text() * 1
				})
				$("#ALL_TJ").text((tj).toFixed(5))

				$(".HC_jgf").each(function(i, sum) {
					jhf += $(sum).text() * 1
				})
				$("#ALL_JG_price").text((jhf).toFixed(5))

				$(".HC_cb").each(function(i, index) {
					cb += $(index).text() * 1
				})
				$("#ALL_CB_price").text((cb).toFixed(5))

			}
		})
		//发泡缓冲材
		$(function() {
			//切换裁切和发泡
			$(document).on("change", "#HCC_ZL", function(e) {
				var zl = $(e.target).val()
				if (zl == 1) {
					$("#HC_FP").css({
						"display": "none"
					})
					$("#HC_CQ").css({
						"display": "block"
					})
				}
				else if (zl == 2) {
					$("#HC_FP").css({
						"display": "block"
					})
					$("#HC_CQ").css({
						"display": "none"
					})
				}
				else {
					$("#HC_FP").css({
						"display": "none"
					})
					$("#HC_CQ").css({
						"display": "none"
					})
				}
			})
			//切换物料类型
			$(document).on("change", "#FP_ZL", function (e) {
				Process_flow($(e.target).val())
				Calculate_the_price()
			})
			//输入物料重量时触发
			$(document).on("keyup", "#FP_WLZL", function() {
				Calculate_the_price()
			})

		})

		$(function() {
			//基础信息修改
			$("#ERjl").click(function() {
				if (confirm("物料修改，会删除现已保存的物料成本价")) {
					var bian = $("#shenDan").text()
					$.ajax({
						url: "/Material/Index",
						type: "POST",
						data: {
							"Ap_bian": bian,
							"state": 8
						},
						success: function(data23) {
                            window.location.href = "/Cuobaojia/Application?App_ban=" + bian + "&&Lj=/Material/ERPGongy";
						},
						error: function() {
							alert("erroer");
						},
					})
				}
				if (confirm("是否更改物料的分类")) {
                    var bian = $("#shenDan").text()
                    window.location.href = "/Application/Application?App_ban=" + bian + "&&Lj=/Material/Index";
                }
			})
			//日志写入数据库
			$(document).on("click", "#RZ_tjrz", function() {
				var now = new Date($.now());
				var year = (now.getFullYear()).toString();
				var month = (now.getMonth() + 1).toString();
				var date = (now.getDate()).toString();
				var hours = (now.getHours()).toString()
				var minutes = (now.getMinutes()).toString()

				//组合当前日期
				var sqrq = year + "/" + month + "/" + date + " " + hours + ":" + minutes
				var rzxx = {
					B_Bian: $("#shenDan").text(),
					B_BR: $('#Login_N').text(),
					B_Date: sqrq,
					B_bei: $('#RZ_xznr').val(),

				};
				console.log(rzxx)
				$.ajax({
					url: "/Contracts/AddLogs",
					type: "POST",
					data: rzxx,
					success: function(data) {
						alert(data)
						gettbz()
					},
					error: function(data) {
						alert("erroer");
					},
				})
			})

			function gettbz() {
				var kan = $("#shenDan").text();
				$.ajax({
					url: "/Application/Application",
					type: "POST",
					data: {
						"App_ban": kan,
						"state": 4
					},
					success: function(sjik) {
						$("#RZ_gwzr div").remove();
						$.each(sjik, function(i, item) {
							var $tr = $(`
										<div>
											<div>
												<span style="color:red">${item.B_BR}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>${item.B_Date}</span>
											</div>
											<div style="border-bottom:1px solid #808080">
												${item.B_bei}
											</div>
										</div>`);
							$("#RZ_gwzr").append($tr);
						})
					},
					error: function() {
						alert("erroer");
					},
				})
			}
		})

        $(function () {
            function Rejected_plan() {
                var ss = $("#WT_SJWt").val()
                var de_id = $("#shenDan").text()
                var bhly = $("#WT_dhly").val()
                var shr = $("#WT_dhr").text()
				if (bhly == "") {
					alert("请输入驳回理由")
                }
                else {
                    var BZJG = [];
                    BZJG.push({
                        AP_bian: de_id,
                        APP_shr: shr,
                        APP_liy: bhly,
                        App_bu: "2",
                        App_zhuang: "驳回"
                    })
                    console.log("共" + BZJG.length + "数据");
                    console.log(BZJG);
                    $.ajax({
                        url: "/Procure/Modify_INF_zhuang6",
                        type: 'POST',
                        data: JSON.stringify(BZJG),
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        success: function (text) {
                            alert(text)
                            var mbr = $("#FQFQi").text()
                            var name = $("#Login_N").text()
                            var BOJL = [];
                            BOJL.push({
                                Fr_fl: "物料询价",//待处理模块
                                De_tiji: "申请单驳回",//待处理内容
                                Cl_juli: mbr,//接收人
                                Nd_jiage: name,//发起人
                                Fr_zhuang: "待处理"//装态
                            })
                            console.log("共" + BOJL.length + "数据");
                            console.log(BOJL);
                            $.ajax({
                                url: "/Contracts/Addfr",
                                type: 'POST',
                                data: JSON.stringify(BOJL),
                                contentType: "application/json;charset=utf-8",
                                dataType: "json",
								success: function (text) {
									console.log(text)
                                    if (text != "新增:0条") {
										alert(text)
                                        location.href = "/Material/JJInksm?SHun=3"
                                    }
                                },
                                error: function (text) {
                                    alert("系统错误" + text);
                                }
                            })

                        },
                        error: function (text) {
                            alert("系统错误" + text);
                        }
                    })
                }
            }
            //点击驳回到业务
			$(document).on("click", "#WT_qdbh", function () {
				var shunf = $("#BHJD").val()
				if (shunf == 1) {
					Rejected_plan()
				} else {
                    Rejected_plan12()
				}
            })
            function Rejected_plan12() {
                var de_id = $("#shenDan").text()
                var bhly = $("#WT_dhly").val()
                var shr = $("#WT_dhr").text()
                if (bhly == "") {
                    alert("请输入驳回理由")
                }
                else {
                    var BZJG = [];
                    BZJG.push({
                        AP_bian: de_id,
                        APP_shr: shr,
                        APP_liy: bhly,
                        App_bu: "1",
                        App_zhuang: "驳回"
                    })
                    console.log("共" + BZJG.length + "数据");
                    console.log(BZJG);
                    $.ajax({
                        url: "/Procure/Modify_INF_zhuang4",
                        type: 'POST',
                        data: JSON.stringify(BZJG),
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        success: function (text) {
                            var regex = /\-?\d+(\.\d+)?/g;
                            var matches = text.match(regex);
                            if (matches == null) {
                                alert("驳回失败！")
                            } else {
                                var mbr = $("#FQFQi").text()
                                var name = $("#Login_N").text()
                                var BZJG = [];
                                BZJG.push({
                                    Fr_fl: "物料询价",//待处理模块
                                    De_tiji: "物料询价被驳回",//待处理内容
                                    Cl_juli: mbr,//接收人
                                    Nd_jiage: name,//发起人
                                    Fr_zhuang: "待处理"//装态
                                })
                                console.log("共" + BZJG.length + "数据");
                                console.log(BZJG);
                                $.ajax({
                                    url: "/Contracts/Addfr",
                                    type: 'POST',
                                    data: JSON.stringify(BZJG),
                                    contentType: "application/json;charset=utf-8",
                                    dataType: "json",
                                    success: function (text) {
                                        var regex = /\-?\d+(\.\d+)?/g;
                                        var matches = text.match(regex);
                                        if (matches == null) {
                                            alert("已驳回至对应人")
                                        } else {
                                            alert("已驳回至对应人")
                                            location.reload(true)
                                            location.href = "/Material/JJInksm?SHun=3"
                                        }

                                    },
                                    error: function (text) {
                                        alert("系统错误" + text);
                                    }
                                })
                            }
                        },
                        error: function (text) {
                            alert("系统错误" + text);
                        }
                    })
                }
            }
            //点击打开驳回面板
            $(document).on("click", "#log_back", function (e) {
                var id = $(e.target).parent().parent().children().first().text()
                $("#WJ_ID").text(id)
                $("#WT_dh_mb").css({ "display": "block" })
                var num = $("#Login_N").text()
                $("#WT_dhr").text(num)
            })
            //点击关闭驳回面板
            $(document).on("click", "#WT_qxbh", function (e) {
                $("#WT_dh_mb").css({ "display": "none" })
                $("#WT_dhly").val("")
                $("#WT_dhr").text("")
                $("#WJ_ID").text("")
            })
		})
		$(function () {
            var shun = "";
            var ghjd = $("#shenDan").text();
            $.ajax({
                url: "/Detailed/Boms",
                type: "POST",
                data: { "binaed": shun, "hudnf": ghjd, "state": 3 },
				success: function (sdf) {

					$("#BoTa_koM tr").remove();
					var jjndn=0
                    $.each(sdf, function (i, item) {
                        var temp7 = item.BOM2_Sone
                        var index = temp7 == "1" ? "纸质" : temp7 == "2" ? "木质" : temp7 == "3" ? "塑料" : temp7 == "4" ? "金属制品" : temp7 == "5" ? "布" : temp7 == "6" ? "胶粘制品" : temp7 == "7" ? "其他" : temp7 == "" ? "套件" : temp7;
                        if (item.BOM2_chen == "Leve0") {
                            $("#leb").text(item.BOM2_Guige)
						}
                        jjndn++
                        var $tr = (`<tr>
                                <td><input type="checkbox" name="trhang" disabled/></td>
                                <td>${jjndn}</td>
                                <td style="display:none">${item.BOM2_id}</td>
                                <td style="display:none">${item.Fo_id}</td>
                                <td style="display:none"><input type="text" class="inwei" name="empShen" value="${item.BOM2_bian}" readonly/></td>
                                <td><label name="empChen" id="labes" >${item.BOM2_chen}</label></td>
                                <td><input type="text" class="inwei" name="empkehu"  value="${item.BOM2_duan}"/></td>
                                <td><input type="text" class="inwei" id="empName" name="empName" value="${item.BOM2_wuLiu}"disabled style="background-color:#fff"/></td>
                                <td style="display:none"><input type="text" name="empLiap"  value="${item.BOM2_liao}"disabled /></td>
                                <td><input type="text" class="inwei" name="empSun"value="${item.BOM2_Guige}"readonly/></td>
                                <td><input type="text" class="inwei" name="empNian" value="${item.BOM2_Nian}"readonly/></td>
                                <td><input type="text" class="inwei" name="empBom" value="${item.BOM2_Yong}"readonly/></td>
                                <td><input type="text" class="inwei" name="empSone" value="${index}"readonly/></td>
                                <td><input type="text" class="inwei" name="empSt" value="${item.BOM2_ST}"readonly/></td>
                                <td><input type="text"class="inwei" name="empLei" value="${item.BOM2_Lei}"readonly/></td>
                                <td><input type="text" class="inwei" name="empTime"  value="${item.BOM2_Ctime}"readonly/></td>
                                <td><input type="text" class="inwei" name="empTime"  value="${item.beih}"readonly/></td>
                            </tr>`);
                        $("#BoTa_koM").append($tr);
                    })
                },
                error: function () {
                    alert("erroer");
                },
            })
		})
    </script>
}